yosuke-i commited on
Commit
a096e1c
1 Parent(s): 76d56bc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -52
app.py CHANGED
@@ -53,56 +53,44 @@ def process_csv(csv_file):
53
  os.rename(output_path, new_path)
54
 
55
  return new_path
56
-
57
- def process_csv_tab1(csv_file):
58
- # CSVファイルの処理ロジック(タブ1用)
59
- # ここでCSVファイルを処理して、結果のCSVファイルを生成
60
- return csv_file
61
-
62
- def process_csv_tab2(csv_file):
63
- # CSVファイルの処理ロジック(タブ2用)
64
- # ここでCSVファイルを処理して、結果のCSVファイルを生成
65
- return csv_file
66
-
67
- def process_csv_tab3(csv_file):
68
- # CSVファイルの処理ロジック(タブ3用)
69
- # ここでCSVファイルを処理して、結果のCSVファイルを生成
70
- return csv_file
71
-
72
- def process_csv(csv_file):
73
- # CSV処理ロジックの実装。ここでは、入力されたCSVファイルをそのまま返します。
74
- # 実際には、ファイルを読み込み、加工し、新しいファイルを生成する処理をここに実装します。
75
  return csv_file
76
-
77
- def process_csv(csv_file):
78
- # ここでCSVファイルを処理します。このサンプルでは、アップロードされたファイルをそのまま返しています。
79
- # 実際の処理ロジックに応じて、ここを変更してください。
80
- return csv_file
81
-
82
- with gr.Blocks() as demo:
83
- with gr.Tabs():
84
- with gr.Tab("タブ1"):
85
- with gr.Column():
86
- csv_upload_tab1 = gr.File(label="CSVファイルをアップロード")
87
- csv_download_tab1 = gr.File(label="ダウンロード", file_count="singular", visible=False)
88
- process_button_tab1 = gr.Button("処理開始")
89
- process_button_tab1.click(
90
- process_csv,
91
- inputs=csv_upload_tab1,
92
- outputs=csv_download_tab1
93
- )
94
-
95
- with gr.Tab("タブ2"):
96
- with gr.Column():
97
- csv_upload_tab2 = gr.File(label="CSVファイルをアップロード")
98
- csv_download_tab2 = gr.File(label="ダウンロード", file_count="singular", visible=False)
99
- process_button_tab2 = gr.Button("処理開始")
100
- process_button_tab2.click(
101
- process_csv,
102
- inputs=csv_upload_tab2,
103
- outputs=csv_download_tab2
104
- )
105
- # さらにタブを追加する場合は、上記のパターンを繰り返します。
106
-
107
- demo.launch(share=True)
108
-
 
 
 
 
 
 
 
53
  os.rename(output_path, new_path)
54
 
55
  return new_path
56
+ def testCSV(csv_file):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  return csv_file
58
+ # interface = gr.Interface(
59
+ # fn=process_csv,
60
+ # inputs=gr.File(label="CSVファイルをアップロード"),
61
+ # outputs=gr.File(label="ダウンロード", file_count="singular"),
62
+ # allow_flagging="never",
63
+ # title="問題生成ツール",
64
+ # article="問題生成FMTは<a href='https://drive.google.com/uc?export=download&id=1fNAco8IDXl3B-mTzlUcGyAz1hOtZyL6V' target='_blank'>こちら</a>からダウンロードしてください。"
65
+
66
+ # )
67
+
68
+ title = "英語生成ツール"
69
+
70
+ with gr.Blocks(theme=gr.themes.Soft()) as demo:
71
+ gr.Markdown(
72
+ f"""
73
+ # {title}
74
+ """
75
+ )
76
+ with gr.Tab("問題生成(選択肢)"):
77
+ with gr.Column():
78
+ with gr.Row():
79
+ inputs=gr.File(label="CSVファイルをアップロード")
80
+ outputs=gr.File(label="ダウンロード", file_count="singular")
81
+ gr.Button("校正スタート").click(
82
+ testCSV,
83
+ inputs=[inputs],
84
+ outputs=[outputs]
85
+ )
86
+ with gr.Tab("問題生成(並び替え)"):
87
+ with gr.Column():
88
+ with gr.Row():
89
+ inputs=gr.File(label="CSVファイルをアップロード")
90
+ outputs=gr.File(label="ダウンロード", file_count="singular")
91
+ gr.Button("校正スタート").click(
92
+ testCSV,
93
+ inputs=[inputs],
94
+ outputs=[outputs]
95
+ )
96
+ demo.launch(share=True)