Fix progress bar compatibility with generators (#9693)

* Fix progress bar compatibility with generators

* add changeset

* Format helpers.py

* Fix

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
This commit is contained in:
brody715 2024-10-16 04:02:28 +08:00 committed by GitHub
parent 31418ef388
commit c45b46652d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
"gradio": patch
---
fix:Fix progress bar compatibility with generators

View File

@ -764,7 +764,7 @@ class Progress(Iterable):
self.iterables.append(new_iterable)
callback(self.iterables)
return self
length = len(iterable) if hasattr(iterable, "__len__") else None # type: ignore
length = len(iterable) if hasattr(iterable, "__len__") else total # type: ignore
self.iterables.append(
TrackedIterable(iter(iterable), 0, length, desc, unit, _tqdm)
)

View File

@ -646,7 +646,7 @@ class Queue:
event,
ProcessCompletedMessage(
output=content,
title=content["title"], # type: ignore
title=content.get("title", "Error"), # type: ignore
success=False,
),
)