Skip to content
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

Fixes TabbedInterface bug where only first interface events get triggered #8504

Merged
merged 3 commits into from
Jun 9, 2024

Conversation

freddyaboulton
Copy link
Collaborator

@freddyaboulton freddyaboulton commented Jun 7, 2024

Description

Closes: #8425

Test with the following demo:

import gradio as gr

hello_world = gr.Interface(lambda name: "Hello " + name, "text", "text")
bye_world = gr.Interface(lambda name: "Bye " + name, "text", "text")

demo = gr.TabbedInterface([hello_world, bye_world], ["Hello World", "Bye World"])

if __name__ == "__main__":
    demo.launch()

🎯 PRs Should Target Issues

Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.

Not adhering to this guideline will result in the PR being closed.

Tests

  1. PRs will only be merged if tests pass on CI. To run the tests locally, please set up your Gradio environment locally and run the tests: bash scripts/run_all_tests.sh

  2. You may need to run the linters: bash scripts/format_backend.sh and bash scripts/format_frontend.sh

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Jun 7, 2024

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website ready! Website preview
🦄 Changes detected! Details

Install Gradio from this PR

pip install https://gradio-builds.s3.amazonaws.com/70331159cf04e29904fb594ecdb0e3a2392db01f/gradio-4.36.0-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@70331159cf04e29904fb594ecdb0e3a2392db01f#subdirectory=client/python"

Install Gradio JS Client from this PR

npm install https://gradio-builds.s3.amazonaws.com/70331159cf04e29904fb594ecdb0e3a2392db01f/gradio-client-1.1.0.tgz

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Jun 7, 2024

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
gradio patch
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Fixes TabbedInterface bug where only first interface events get triggered

Maintainers or the PR author can modify the PR title to modify this entry.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

Sorry, something went wrong.

gradio-pr-bot and others added 2 commits June 7, 2024 22:44
@freddyaboulton freddyaboulton marked this pull request as ready for review June 7, 2024 23:06
@@ -1355,6 +1355,7 @@ def render(self):
if isinstance(dep.api_name, str)
]
for dependency in self.fns.values():
dependency._id += dependency_offset
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on using uuids for the ids @aliabid94 ?

)
with connect(demo) as client:
assert client.predict("Emily", api_name="/predict") == "Hello Emily"
assert client.predict("Hannah", api_name="/predict") == "Hello Hannah"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should test the /predict_1 endpoint as well

Suggested change
assert client.predict("Hannah", api_name="/predict") == "Hello Hannah"
assert client.predict("Hannah", api_name="/predict_1") == "Bye Hannah"

Copy link
Member

@abidlabs abidlabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm thanks @freddyaboulton!

@abidlabs abidlabs merged commit 2a59bab into main Jun 9, 2024
7 checks passed
@abidlabs abidlabs deleted the 8245-tabbed-interface-fix branch June 9, 2024 15:30
@pngwn pngwn mentioned this pull request Jun 9, 2024
@fakerybakery fakerybakery mentioned this pull request Jun 10, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TabbedInterface Error: the 'clear' and 'submit' of the second tab will operate the first tab
3 participants