yosuke-i commited on
Commit
377b6ef
1 Parent(s): e39cc73

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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
  # アプリの起動