Fixes #7136 -- gradio client iterator can hit finish event before yield all outputs (#7151)

This commit is contained in:
PSEUDOTENSOR / Jonathan McKinney 2024-01-25 16:57:30 -08:00 committed by GitHub
parent 138761226a
commit 40e6ddf911
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1557,7 +1557,10 @@ class Job(Future):
o = self.communicator.job.outputs[self._counter]
self._counter += 1
return o
if self.communicator.job.latest_status.code == Status.FINISHED:
if (
self.communicator.job.latest_status.code == Status.FINISHED
and self._counter >= len(self.communicator.job.outputs)
):
raise StopIteration()
time.sleep(0.001)