Skip to content

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

Closed
@abidlabs

Description

@abidlabs

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    PriorityHigh priority issuesbugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions