Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,19 @@
|
|
1 |
import gradio as gr
|
2 |
import pandas as pd
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
|
|
|
|
9 |
fn=double_age,
|
10 |
-
inputs=gr.
|
11 |
-
outputs="
|
12 |
-
|
|
|
|
|
13 |
)
|
14 |
|
15 |
-
|
|
|
1 |
import gradio as gr
|
2 |
import pandas as pd
|
3 |
+
|
4 |
+
def double_age(csv_file):
|
5 |
+
df = pd.read_csv(csv_file.name)
|
6 |
+
df['age'] = df['age'] * 2
|
7 |
+
csv_data = df.to_csv(index=False)
|
8 |
+
return csv_data
|
9 |
+
|
10 |
+
interface = gr.Interface(
|
11 |
fn=double_age,
|
12 |
+
inputs=gr.File(label="CSVファイルをアップロード"),
|
13 |
+
outputs=gr.File(label="ダウンロード"),
|
14 |
+
examples=[
|
15 |
+
["example_data.csv"] # サンプルデータがあれば指定します
|
16 |
+
]
|
17 |
)
|
18 |
|
19 |
+
interface.launch()
|