I am a beginner in gradio. The items in my gr.dropdown come from all the keys in a dictionary. When the user is operating, he can change the key and value added to the dictionary. At this time, I want the drop-down box to update the latest keys at the same time. How can I do it?
……………………………………………………………………………………………………………………………………………………….
dropdown1 = gr.Dropdown(choices=list(dropdown_options.keys()), label="report1")
dropdown2 = gr.Dropdown(choices=list(dropd
own_options.keys()), label="report2")
submit_report = gr.Button("submit")
def create_dropdown(options, label):
return gr.Dropdown(choices=list(dropdown_options.keys()), label=label,interactive=True)
# Using state variables to store drop-down options
dropdown_options_state = gr.State(value=getdict())
.....
dropdown1 = create_dropdown(dropdown_options_state.value, "report1")
dropdown2 = create_dropdown(dropdown_options_state.value, "report2")
submit_report = gr.Button("sumbit
")
gr.State doesn’t seem to work
jjj ccc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.