import gradio as gr import pandas as pd import json def excel_to_json(file): # エクセルファイルを読み込み df = pd.read_excel(file) # C列の2行目以降の値を取得 column_values = df.iloc[1:, 2].tolist() # JSON形式に変換 json_result = json.dumps(column_values, ensure_ascii=False, indent=2) return json_result # Gradioインターフェースの設定 interface = gr.Interface( fn=excel_to_json, inputs=gr.File(label="Upload Excel File"), outputs=gr.Textbox(label="JSON Output"), title="Excel to JSON Converter", description="Upload an Excel file and get JSON output of column C values from the second row onward." ) # Gradioアプリの実行 interface.launch()