Skip to content

Example caching doesn't work with gr.update() #2305

@abidlabs

Description

@abidlabs

Describe the bug

If a function returns a gr.update(), it will not work correctly with example caching. Here are a couple of failure modes:

(1) The caching does not happen at all, and an Exception is thrown

Example:

import gradio as gr

io = gr.Interface(lambda x: gr.update(visible=False), "textbox", "html", examples=["hi"], cache_examples=True).launch()

Error:

AttributeError: 'dict' object has no attribute 'startswith'

(2) Caching happens without error, but when the example is clicked, the update does not happen as expected:

Example:

import gradio as gr

io = gr.Interface(lambda x: gr.update(visible=False), "textbox", "textbox", examples=["hi"], cache_examples=True).launch()

Error:

image

Is there an existing issue for this?

  • I have searched the existing issues

Reproduction

See above

Screenshot

See above

Logs

See above

System Info

gradio==3.3.1

Severity

serious, but I can work around it

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions