In addtion, if I printed the ex, I found it was text key.
Have you searched existing issues? 🔎
[x] I have searched and found no existing issues
Reproduction
import gradio as gr
def update_examples():
return gr.Dataset(samples=[{'text': 'gradio', 'files': ['path/of/image2']}])
with gr.Blocks() as demo:
textbox = gr.MultimodalTextbox(show_label=False, placeholder="test", file_count='multiple', file_types=['image'])
examples = gr.Examples([{'text': 'gradio', 'files': ['path/of/image1']}], textbox)
update_btn = gr.Button(value="Update Examples")
update_btn.click(update_examples, None, examples.dataset)
Screenshot
No response
Logs
No response
System Info
gradio 4.41.0
gradio_client 1.3.0
Severity
I can work around it
import gradio as gr
def update_examples():
# here is different
# use an additional [] to wrap the {'text': 'gradio', 'files': ['path/of/image2']}
return gr.Dataset(samples=[[{'text': 'gradio', 'files': ['path/of/image2']}]])
with gr.Blocks() as demo:
textbox = gr.MultimodalTextbox(show_label=False, placeholder="test", file_count='multiple', file_types=['image'])
examples = gr.Examples([{'text': 'gradio', 'files': ['path/of/image1']}], textbox)
update_btn = gr.Button(value="Update Examples")
update_btn.click(update_examples, None, examples.dataset)
Describe the bug
When I combined gr.Example with gr.MultimodalTextbox, it raised an error
ValueError: MultimodalTextbox expects a dictionary with optional keys 'text' and 'files'. Received str
if I updated the examples following the docs (https://www.gradio.app/docs/gradio/examples#examples). The reason is the Dataset can not work well with dict data. https://github.com/gradio-app/gradio/blob/62ed369efa6befac9a0eac736edcfa87a8d87a43/gradio/components/dataset.py#L102-L116In addtion, if I printed the ex, I found it was
text
key.Have you searched existing issues? 🔎
Reproduction
Screenshot
No response
Logs
No response
System Info
Severity
I can work around it