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

Add Lazy Loading Support for Tabs/Components #10282

Open
1 task done
huhu415 opened this issue Jan 3, 2025 · 2 comments
Open
1 task done

Add Lazy Loading Support for Tabs/Components #10282

huhu415 opened this issue Jan 3, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@huhu415
Copy link

huhu415 commented Jan 3, 2025

  • I have searched to see if a similar issue already exists.

Is your feature request related to a problem? Please describe.
My Gradio app has many tabs, and each tab has quite a few functionalities.
And I'm increasingly finding that the loading speed is too slow because it loads all tabs every time.

Describe the solution you'd like
Add lazy loading functionality, so that tabs are only loaded when they are needed/accessed.

Additional context
I tried to implement it this way, but it doesn't work:

import gradio as gr

def toggle_render():
    return gr.update(render=True)


def lazy_load():
    with gr.Blocks() as demo:
        with gr.Accordion(render=False) as tabs:
            print("this has loaded...")
            text1 = gr.Textbox()

        # Load event to show the accordion
        demo.load(fn=toggle_render,  outputs=tabs)

    return demo

@abidlabs abidlabs added the enhancement New feature or request label Jan 3, 2025
@abidlabs
Copy link
Member

abidlabs commented Jan 3, 2025

We are working on this! cc @pngwn

@huhu415
Copy link
Author

huhu415 commented Jan 3, 2025

wa~ cool!🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants