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

Allow showing progress updates on arbitrary components #10492

Merged
merged 14 commits into from
Feb 6, 2025
Merged

Conversation

abidlabs
Copy link
Member

@abidlabs abidlabs commented Feb 3, 2025

Closes: #3714, this is something that I've found quite needed in my own gradio apps as well.

Test code:

import gradio as gr
import time

def fake():
    time.sleep(1)
    return ["Done"]*2

with gr.Blocks() as demo:
    with gr.Row():
        b = gr.Button()
        t1 = gr.Textbox("Both of these will update...")
        t2 = gr.Textbox("...but only this one will show a loading indicator")

    b.click(fake, None, [t1, t2], show_progress_on=t2, show_progress="minimal")

demo.launch()

The frontend changes are hacky and I'm almost certain there's a better way, but could use some help with making the changes work with the status store that we use, cc @aliabid94 @pngwn perhaps.

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Feb 3, 2025

🪼 branch checks and previews

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

Install Gradio from this PR

pip install https://gradio-pypi-previews.s3.amazonaws.com/5a4e989918f79f53cf66e6e5e2d18456538975ee/gradio-5.15.0-py3-none-any.whl

Install Gradio Python Client from this PR

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

Install Gradio JS Client from this PR

npm install https://gradio-npm-previews.s3.amazonaws.com/5a4e989918f79f53cf66e6e5e2d18456538975ee/gradio-client-1.11.0.tgz

Use Lite from this PR

<script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/5a4e989918f79f53cf66e6e5e2d18456538975ee/dist/lite.js""></script>

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Feb 3, 2025

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
@gradio/client minor
@gradio/core minor
gradio minor
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Allow showing progress updates on arbitrary components

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.

@abidlabs abidlabs changed the title Allow showing progress updates on specific components Allow showing progress updates on arbitrary components Feb 3, 2025
@abidlabs abidlabs marked this pull request as ready for review February 5, 2025 01:23
@abidlabs abidlabs marked this pull request as draft February 5, 2025 01:23
@abidlabs abidlabs marked this pull request as ready for review February 5, 2025 19:53
@abidlabs
Copy link
Member Author

abidlabs commented Feb 6, 2025

Ah nice thanks @aliabid94. Simpler than I expected.

@abidlabs abidlabs merged commit 29880d5 into main Feb 6, 2025
22 of 23 checks passed
@abidlabs abidlabs deleted the progress-specific branch February 6, 2025 00:52
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.

Allow showing progress updates on specific components
2 participants