SPARC64 commited on
Commit
9d605a5
·
verified ·
1 Parent(s): 3507446

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -81,7 +81,7 @@ def export_results(results, search_condition):
81
  if not results:
82
  return None, "エラー: エクスポートするデータがありません。"
83
 
84
- filename = f"search_results_{datetime.now(JST).strftime('%Y-%m-%d_%H-%M-%S')}.txt"
85
  file_path = os.path.join("/tmp", filename)
86
 
87
  execution_date = datetime.now(JST).strftime("%Y/%m/%d %H:%M:%S")
@@ -95,7 +95,7 @@ def export_results(results, search_condition):
95
  f.write("-" * 40 + "\n")
96
  f.write(results + "\n")
97
 
98
- return file_path, "TXTファイルのダウンロードが可能になりました。"
99
  except Exception as e:
100
  return None, f"エラー: {str(e)}"
101
 
@@ -121,7 +121,7 @@ with gr.Blocks() as demo:
121
 
122
  # エクスポート機能
123
  export_button = gr.Button("TXTをエクスポートする")
124
- export_output = gr.File(label="ダウンロード", interactive=False)
125
  export_status = gr.Textbox(label="エクスポートメッセージ", interactive=False)
126
 
127
  search_button.click(
 
81
  if not results:
82
  return None, "エラー: エクスポートするデータがありません。"
83
 
84
+ filename = f"search_results_{datetime.now(JST).strftime('%Y%m%d_%H%M%S')}.txt"
85
  file_path = os.path.join("/tmp", filename)
86
 
87
  execution_date = datetime.now(JST).strftime("%Y/%m/%d %H:%M:%S")
 
95
  f.write("-" * 40 + "\n")
96
  f.write(results + "\n")
97
 
98
+ return file_path, "エクスポート完了"
99
  except Exception as e:
100
  return None, f"エラー: {str(e)}"
101
 
 
121
 
122
  # エクスポート機能
123
  export_button = gr.Button("TXTをエクスポートする")
124
+ export_output = gr.File(label="結果をダウンロード", interactive=True) # "ファイル名.txt" ではなく固定
125
  export_status = gr.Textbox(label="エクスポートメッセージ", interactive=False)
126
 
127
  search_button.click(