Skip to content

Commit

Permalink
Use AsyncStopIteration
Browse files Browse the repository at this point in the history
  • Loading branch information
freddyaboulton committed Oct 7, 2022
1 parent f812365 commit 41d39f9
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gradio/blocks.py
Expand Up @@ -707,7 +707,7 @@ async def call_function(self, fn_index, processed_input, iterator=None):
utils.async_iteration, iterator, limiter=self.limiter
)
is_generating = True
except GradioStopIteration:
except StopAsyncIteration:
n_outputs = len(self.dependencies[fn_index].get("outputs"))
prediction = (
components._Keywords.FINISHED_ITERATING
Expand Down
4 changes: 0 additions & 4 deletions gradio/exceptions.py
Expand Up @@ -9,7 +9,3 @@ def __init__(self, message: str):

def __str__(self):
return repr(self.message)


class GradioStopIteration(ValueError):
pass
2 changes: 1 addition & 1 deletion gradio/utils.py
Expand Up @@ -389,7 +389,7 @@ def async_iteration(iterator):
return next(iterator)
except StopIteration:
# raise a ValueError here because co-routines can't raise StopIteration themselves
raise gradio.exceptions.GradioStopIteration()
raise StopAsyncIteration()


class Request:
Expand Down

0 comments on commit 41d39f9

Please sign in to comment.