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

Cannot display outputs when reusing cached examples #5634

Closed
1 task done
aaronng91 opened this issue Sep 20, 2023 · 1 comment · Fixed by #5636
Closed
1 task done

Cannot display outputs when reusing cached examples #5634

aaronng91 opened this issue Sep 20, 2023 · 1 comment · Fixed by #5636
Labels
bug Something isn't working

Comments

@aaronng91
Copy link

aaronng91 commented Sep 20, 2023

Describe the bug

When using Examples and setting cache_examples=True, the inputs/outputs load fine when you start app for the first time. However, if you reload the app which reads from the same cache, the outputs no longer load. No examples or methods have changed.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr

def combine(a, b):
    return a + " " + b

with gr.Blocks() as demo:
    txt = gr.Textbox(label="Input", lines=2)
    txt_2 = gr.Textbox(label="Input 2")
    txt_3 = gr.Textbox(value="", label="Output")
    btn = gr.Button(value="Submit")
    btn.click(combine, inputs=[txt, txt_2], outputs=[txt_3])
    
    gr.Markdown("## Text Examples")
    gr.Examples(
        [["hi", "Adam"], ["hello", "Eve"]],
        [txt, txt_2],
        txt_3,
        combine,
        cache_examples=True,
    )

if __name__ == "__main__":
    demo.launch()

Screenshot

Output loads fine when initializing cache for the first time
Screenshot 2023-09-20 at 17 18 18

Output no longer loads when reusing the same cache
Screenshot 2023-09-20 at 17 17 57

Logs

Logs when initializing cache for the first time

Caching examples at: '/home/aaronn/git/test/gradio_cached_examples/6'
Caching example 1/2
Caching example 2/2
Caching complete

Running on local URL:  http://0.0.0.0:7860

To create a public link, set `share=True` in `launch()`.

Logs when reusing cache

Using cache from '/home/aaronn/git/test/gradio_cached_examples/6' directory. If method or examples have changed since last caching, delete this folder to clear cache.

Running on local URL:  http://0.0.0.0:7860

To create a public link, set `share=True` in `launch()`.

System Info

gradio==3.41.2

Severity

Blocking usage of gradio

@aaronng91 aaronng91 added the bug Something isn't working label Sep 20, 2023
@freddyaboulton
Copy link
Collaborator

Thanks @aaronng91 - I can reproduce.

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

Successfully merging a pull request may close this issue.

2 participants