-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support gr.load()
-ing Gradio apps with Blocks.load()
events
#10324
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-pypi-previews.s3.amazonaws.com/d6ff0183e7b262b68868a8659095330065daf1b0/gradio-5.11.0-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@d6ff0183e7b262b68868a8659095330065daf1b0#subdirectory=client/python" Install Gradio JS Client from this PR npm install https://gradio-npm-previews.s3.amazonaws.com/d6ff0183e7b262b68868a8659095330065daf1b0/gradio-client-1.9.0.tgz Use Lite from this PR <script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/d6ff0183e7b262b68868a8659095330065daf1b0/dist/lite.js""></script> |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
gr.load()
-ing a gr.ChatInterface
gr.load()
-ing Gradio apps with Blocks.load()
events
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice fix @abidlabs - left some minor comments
gradio/blocks.py
Outdated
# Any event -- e.g. Blocks.load() -- that is triggered by this Blocks | ||
# should now be triggered by the root Blocks instead. | ||
for target in dependency.targets: | ||
print("target", target, "self._id", self._id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove print
gradio/blocks.py
Outdated
@@ -3008,3 +3007,29 @@ def get_api_info(self, all_endpoints: bool = False) -> dict[str, Any] | None: | |||
api_info["named_endpoints"][f"/{fn.api_name}"] = dependency_info | |||
|
|||
return api_info | |||
|
|||
@staticmethod | |||
def get_target_events( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit but I feel like get_event_targets
is a more accurate name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed
Thanks @freddyaboulton! Addressed suggestions |
And some minor cleanup. Closes: #10312
Test with something like this: