Update app.py
Browse files
app.py
CHANGED
@@ -14,13 +14,13 @@ def process_csv(file_obj):
|
|
14 |
df.to_csv(output, index=False)
|
15 |
output.seek(0)
|
16 |
|
17 |
-
# StringIO
|
18 |
-
return output
|
19 |
|
20 |
-
# Gradioインターフェースの定義
|
21 |
iface = gr.Interface(fn=process_csv,
|
22 |
inputs=gr.File(label="Upload CSV"),
|
23 |
-
outputs=gr.File(label="Download Processed CSV"),
|
24 |
description="Upload a CSV with 'name' and 'age' columns. This app will double the 'age' and return the processed CSV.")
|
25 |
|
26 |
# アプリの起動
|
|
|
14 |
df.to_csv(output, index=False)
|
15 |
output.seek(0)
|
16 |
|
17 |
+
# StringIOオブジェクトの内容をバイト列として返す
|
18 |
+
return output.getvalue().encode('utf-8')
|
19 |
|
20 |
+
# Gradioインターフェースの定義
|
21 |
iface = gr.Interface(fn=process_csv,
|
22 |
inputs=gr.File(label="Upload CSV"),
|
23 |
+
outputs=gr.File(label="Download Processed CSV", type="file"),
|
24 |
description="Upload a CSV with 'name' and 'age' columns. This app will double the 'age' and return the processed CSV.")
|
25 |
|
26 |
# アプリの起動
|