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

Only render visible components #10192

Open
wants to merge 263 commits into
base: main
Choose a base branch
from
Open

Only render visible components #10192

wants to merge 263 commits into from

Conversation

pngwn
Copy link
Member

@pngwn pngwn commented Dec 13, 2024

Closes: #5311

freddyaboulton and others added 30 commits July 25, 2024 12:51
* changes

* add changeset

* hash

* changes

* remove

* changes

* rename

* internal

* changes

* remove json path

* merge

* fix tests

---------

Co-authored-by: gradio-pr-bot <[email protected]>
* remove logoutbutton page

* remove huggingfacedatasetsaver
* HTTP live streaming

* type check

* fix code

* Fix code

* add code

* Video demo

* Fix tests

* Update notebook

* Add guide

* Fix demo

* Allow downloading

* revert

* Fix download filename

* lint

* notebooks

* fix video demo

* Fix config

* Fix audio repeated play bug

* Improve guide

* fix audio?

* Use cantina

* Code

* type check

* add code

* Use runtimeerror

* Add code
* prevent null origin requests by default

* changes

* add changeset

* format

---------

Co-authored-by: gradio-pr-bot <[email protected]>
* Tweaks

* Better

* typo

* lint
* changes

* changes

* add changeset

* add changeset

* Ci security tweaks (#9010)

* asd

* asd

* asd

* asd

* asd

* asd

* asd

* asd

* asd

* asd

* asd

* asd

* asd

* asd

* change

* changes

* changes

* changes

* changes

* changes

* changes

---------

Co-authored-by: Ali Abid <[email protected]>
Co-authored-by: gradio-pr-bot <[email protected]>
Co-authored-by: pngwn <[email protected]>
* changes

* changes

* changes

---------

Co-authored-by: Ali Abid <[email protected]>
* changes

* add changeset

* docstring

* change

* client changess

---------

Co-authored-by: gradio-pr-bot <[email protected]>
…preprocessing (#9073)

* audio format

* add changeset

* lint

* docstring

* format

* fix tests

* tweaks

* refactor

* fix

---------

Co-authored-by: gradio-pr-bot <[email protected]>
* Fix code

* Add code

* Add code

* working demo

* hacky video

* Add code for video

* Fixing some code

* clean queieing

* low streaming mode audio

* reworking

* remove console

* Pretty good spot

* Delete unused

* consolidate

* Add progress bar

* Set time limit null

* delete

* Fix then issue

* merge out

* Add code

* clean up

* Remove base64

* Add code

* minor bugs

* End stream

* Fix rerender

* remove unwanted

* Address streaming comments

* Commit file lol

* ;int

* lint backend

* lint

* Fix queue status. Stream_every defined in event

* Fix types

* Add code

* Add code

* Add code

* queue time

* docstring wording

* Fix typo

* add changeset

---------

Co-authored-by: Abubakar Abid <[email protected]>
Co-authored-by: gradio-pr-bot <[email protected]>
@pngwn pngwn marked this pull request as draft December 13, 2024 01:09
@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Dec 13, 2024

🪼 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/affd1353009e3ddcec102cbbe0feb6350ba2f68d/gradio-5.9.0-py3-none-any.whl

Install Gradio Python Client from this PR

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

Install Gradio JS Client from this PR

npm install https://gradio-npm-previews.s3.amazonaws.com/affd1353009e3ddcec102cbbe0feb6350ba2f68d/gradio-client-1.8.0.tgz

Use Lite from this PR

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

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Dec 13, 2024

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
@gradio/atoms minor
@gradio/core minor
@gradio/imageeditor minor
@gradio/markdown minor
@gradio/markdown-code minor
@gradio/tabitem minor
@gradio/tabs minor
gradio minor
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Only render visible 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.

@pngwn pngwn marked this pull request as ready for review December 14, 2024 02:00
@pngwn pngwn changed the title Render visible Only render visible components Dec 14, 2024
@abidlabs abidlabs self-requested a review December 14, 2024 04:19
@abidlabs
Copy link
Member

Taking a look at this now @pngwn but just a thought that this might be a good time to add a demo along the lines #5217 and benchmark that demo before and after this PR, leading to some nice comms around how much faster / less memory-intensive gradio is with this PR

@abidlabs
Copy link
Member

Very very cool @pngwn! I tried a lot of demos and generally everything is working as expected. Only two exceptions:

(1) The ImageEditor does not seem to be saving its state when unrendered and re-rendered. Try with this example:

import gradio as gr

with gr.Blocks() as demo:
    with gr.Tab("Abc"):
        gr.Textbox()
    with gr.Tab("Abc"):
        gr.ImageEditor()

demo.launch()
Screen.Recording.2024-12-16.at.3.54.09.PM.mov

I checked and on main, the ImageEditor state is saved.

(2) The webcam also seems to reset when unrendered and re-rendered. Try running demo/webcam_constraints/run.py.

Screen.Recording.2024-12-16.at.3.52.40.PM.mov

It turns out that the behavior on main is also broken but in a different way. In main, the webcam recording just becomes corrupted when a different tab is selected. The behavior I would expect is that when a different tab is selected, the webcam stops recording but the video recorded up until that point is saved.

@aliabid94
Copy link
Collaborator

Tried to break it with gr.render but everything worked great!

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.

Only render components that are "visible".