taskforce-dev commited on
Commit
8b13cc0
·
verified ·
1 Parent(s): a3a992b

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pandas as pd
3
+ import json
4
+
5
+ def excel_to_json(file):
6
+ # エクセルファイルを読み込み
7
+ df = pd.read_excel(file)
8
+
9
+ # C列の2行目以降の値を取得
10
+ column_values = df.iloc[1:, 2].tolist()
11
+
12
+ # JSON形式に変換
13
+ json_result = json.dumps(column_values, ensure_ascii=False, indent=2)
14
+
15
+ return json_result
16
+
17
+ # Gradioインターフェースの設定
18
+ interface = gr.Interface(
19
+ fn=excel_to_json,
20
+ inputs=gr.inputs.File(label="Upload Excel File"),
21
+ outputs=gr.outputs.Textbox(label="JSON Output"),
22
+ title="Excel to JSON Converter",
23
+ description="Upload an Excel file and get JSON output of column C values from the second row onward."
24
+ )
25
+
26
+ # Gradioアプリの実行
27
+ interface.launch()