Skip to content

Commit

Permalink
return a Dependency instance from Blocks.load event listener
Browse files Browse the repository at this point in the history
  • Loading branch information
anentropic committed May 22, 2023
1 parent 38607c9 commit 63caf9e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gradio/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,9 @@ def get_time():
name=name, src=src, hf_token=api_key, alias=alias, **kwargs
)
else:
return self_or_cls.set_event_trigger(
from gradio.events import Dependency

dep, dep_index = self_or_cls.set_event_trigger(
event_name="load",
fn=fn,
inputs=inputs,
Expand All @@ -1498,7 +1500,8 @@ def get_time():
max_batch_size=max_batch_size,
every=every,
no_target=True,
)[0]
)
return Dependency(self_or_cls, dep, dep_index)

def clear(self):
"""Resets the layout of the Blocks object."""
Expand Down

0 comments on commit 63caf9e

Please sign in to comment.