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

Cached examples do not work inside gr.render() #10581

Open
1 task done
abidlabs opened this issue Feb 12, 2025 · 0 comments
Open
1 task done

Cached examples do not work inside gr.render() #10581

abidlabs opened this issue Feb 12, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@abidlabs
Copy link
Member

Describe the bug

Example caching does not work inside gr.render() because the Examples/Interface code is not executed at runtime. The fix would be that if the cached example does not exist, it should be cached when the user clicks on the example (similar to lazy caching). However, we should make sure that if an Examples is re-rendered, the cached examples are not used since the function to generate those Examples may have changed.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr

with gr.Blocks() as demo:
    @gr.render()
    def cached_interface():
        gr.Interface(lambda x:x, "textbox", "textbox", examples=["abc"], cache_examples=True)

demo.launch()

Screenshot

No response

Logs

System Info

gradio==5.16

Severity

I can work around it

@abidlabs abidlabs added the bug Something isn't working label Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant