Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -450,6 +450,7 @@ system_integration = """
|
|
| 450 |
## ✅ 輸出格式:
|
| 451 |
- 使用繁體中文
|
| 452 |
- **請使用 Markdown 格式化您的回覆,例如使用粗體標示重點數字、使用項目符號條列結果。**
|
|
|
|
| 453 |
- 數值一律轉為千分位
|
| 454 |
- 每份資料來源僅列一次
|
| 455 |
- 若缺資料請誠實說明並結束回答
|
|
@@ -631,7 +632,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="orange"),
|
|
| 631 |
with gr.Column(scale=1):
|
| 632 |
user_input_box = gr.Textbox(
|
| 633 |
label="請在此輸入您的問題",
|
| 634 |
-
placeholder="例如:113年底前金區人口數?",
|
| 635 |
lines=5
|
| 636 |
)
|
| 637 |
gr.Examples(
|
|
@@ -654,6 +655,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="orange"),
|
|
| 654 |
with gr.Row():
|
| 655 |
btn_clear = gr.ClearButton(value="清除")
|
| 656 |
btn_submit = gr.Button("送出查詢", variant="primary")
|
|
|
|
| 657 |
|
| 658 |
with gr.Column(scale=1):
|
| 659 |
output_analysis = gr.Textbox(
|
|
@@ -681,8 +683,19 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue", secondary_hue="orange"),
|
|
| 681 |
|
| 682 |
# --- 事件綁定 ---
|
| 683 |
outputs_list = [output_analysis, output_result]
|
| 684 |
-
btn_submit.click(fn=gradio_interface, inputs=user_input_box, outputs=outputs_list)
|
| 685 |
-
user_input_box.submit(fn=gradio_interface, inputs=user_input_box, outputs=outputs_list)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 686 |
btn_clear.add([user_input_box] + outputs_list)
|
| 687 |
|
| 688 |
# --- 啟動應用程式 ---
|
|
|
|
| 450 |
## ✅ 輸出格式:
|
| 451 |
- 使用繁體中文
|
| 452 |
- **請使用 Markdown 格式化您的回覆,例如使用粗體標示重點數字、使用項目符號條列結果。**
|
| 453 |
+
- 逐項列出的結果請由大到小排序。
|
| 454 |
- 數值一律轉為千分位
|
| 455 |
- 每份資料來源僅列一次
|
| 456 |
- 若缺資料請誠實說明並結束回答
|
|
|
|
| 632 |
with gr.Column(scale=1):
|
| 633 |
user_input_box = gr.Textbox(
|
| 634 |
label="請在此輸入您的問題",
|
| 635 |
+
placeholder="例如:113年底前金區人口數?(小技巧:查不到資料時可轉換問法)",
|
| 636 |
lines=5
|
| 637 |
)
|
| 638 |
gr.Examples(
|
|
|
|
| 655 |
with gr.Row():
|
| 656 |
btn_clear = gr.ClearButton(value="清除")
|
| 657 |
btn_submit = gr.Button("送出查詢", variant="primary")
|
| 658 |
+
btn_stop = gr.Button("中止", variant="stop")
|
| 659 |
|
| 660 |
with gr.Column(scale=1):
|
| 661 |
output_analysis = gr.Textbox(
|
|
|
|
| 683 |
|
| 684 |
# --- 事件綁定 ---
|
| 685 |
outputs_list = [output_analysis, output_result]
|
| 686 |
+
# btn_submit.click(fn=gradio_interface, inputs=user_input_box, outputs=outputs_list)
|
| 687 |
+
# user_input_box.submit(fn=gradio_interface, inputs=user_input_box, outputs=outputs_list)
|
| 688 |
+
|
| 689 |
+
submit_event = btn_submit.click(fn=gradio_interface, inputs=user_input_box, outputs=outputs_list)
|
| 690 |
+
textbox_submit_event = user_input_box.submit(fn=gradio_interface, inputs=user_input_box, outputs=outputs_list)
|
| 691 |
+
|
| 692 |
+
btn_stop.click(
|
| 693 |
+
fn=None,
|
| 694 |
+
inputs=None,
|
| 695 |
+
outputs=None,
|
| 696 |
+
cancels=[submit_event, textbox_submit_event]
|
| 697 |
+
)
|
| 698 |
+
|
| 699 |
btn_clear.add([user_input_box] + outputs_list)
|
| 700 |
|
| 701 |
# --- 啟動應用程式 ---
|