Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
| 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, "
|
| 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="
|
| 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(
|