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

Fix UI freeze on rapid generators #7055

Merged
merged 4 commits into from Jan 18, 2024
Merged

Fix UI freeze on rapid generators #7055

merged 4 commits into from Jan 18, 2024

Conversation

aliabid94
Copy link
Collaborator

Fixes: #6609

Demo:

import gradio as gr
import time

def bot():
    for i in range(100):
        yield "hello " * i
    print("done")

with gr.Blocks() as demo:
    output = gr.HTML(elem_id="output_html")
    msg = gr.Number()
    msg.submit(bot, None, output)

    n_elements = 5000
    for i in range(n_elements):
        gr.Button()

demo.launch()

Will explain fix with code comments

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Jan 18, 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/724d0272229ff0c306f8704934bb42c4fd239c28/gradio-4.14.0-py3-none-any.whl

Install Gradio Python Client from this PR

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

@gradio-pr-bot
Copy link
Contributor

gradio-pr-bot commented Jan 18, 2024

🦄 change detected

This Pull Request includes changes to the following packages.

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

With the following changelog entry.

Fix UI freeze on rapid generators

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.

client/js/src/client.ts Outdated Show resolved Hide resolved
@aliabid94 aliabid94 requested a review from pngwn January 18, 2024 08:41
Copy link
Member

@pngwn pngwn left a comment

Choose a reason for hiding this comment

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

This is awesome. Tested the original repro and everything is working great! Also went through the demos and can't see any changes in behaviour.

Thanks for figuring this one out @aliabid94! Very weird browser behaviour.

client/js/src/client.ts Outdated Show resolved Hide resolved
@freddyaboulton
Copy link
Collaborator

Very nice!

@aliabid94 aliabid94 merged commit 3c3cf86 into main Jan 18, 2024
11 checks passed
@aliabid94 aliabid94 deleted the fix_quick_generation branch January 18, 2024 19:50
@pngwn pngwn mentioned this pull request Jan 18, 2024
@pseudotensor
Copy link
Contributor

pseudotensor commented Jan 18, 2024

Thanks! I'm hopeful I can upgrade to gradio4 soon!

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.

gradio 4 UI locks up when components become active with generators
5 participants