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!
from openpyxl import load_workbook
import pandas as pd
import gradio as gr
workbook = load_workbook(file.name)
for i in workbook.sheetnames:
return gr.update(value=, choices=sheets)
with gr.Blocks() as demo:
# 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)
if name == “main”: