Update dropdown
Here is the code, which means when the file is uploaded, the dropdown will show the list of xlsx(or csv) file sheet name, but it did not work.if anyone could give some advice, thanks a lot!import openpyxlfrom openpyxl import load_workbookimport pandas as pdimport gradio as grdef read_excel(file):workbook = load_workbook(file.name)sheets =for i in workbook.sheetnames:sheets.append(i)print(sheets)print(type(sheets))return gr.update(value=, choices=sheets)with gr.Blocks() as demo:gr.Markdown(“”"# Hello World!Start typing below to see the output.“”")file_csv = gr.File(label=“upload”, file_types=[‘xlsx’,‘csv’])out = gr.Dropdown(multiselect=True)
file_csv.change(read_excel, file_csv, out)ifname== “main”:demo.launch(debug=True)