Skip to content

Commit

Permalink
Fix progress bar compatibility with generators (#9693)
Browse files Browse the repository at this point in the history
* Fix progress bar compatibility with generators

* add changeset

* Format helpers.py

* Fix

---------

Co-authored-by: Abubakar Abid <[email protected]>
Co-authored-by: gradio-pr-bot <[email protected]>
Co-authored-by: Freddy Boulton <[email protected]>
  • Loading branch information
4 people authored Oct 15, 2024
1 parent 31418ef commit c45b466
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/khaki-sites-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gradio": patch
---

fix:Fix progress bar compatibility with generators
2 changes: 1 addition & 1 deletion gradio/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ def tqdm(
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)
)
Expand Down
2 changes: 1 addition & 1 deletion gradio/queueing.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ async def process_events(
event,
ProcessCompletedMessage(
output=content,
title=content["title"], # type: ignore
title=content.get("title", "Error"), # type: ignore
success=False,
),
)
Expand Down

0 comments on commit c45b466

Please sign in to comment.