Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -81,15 +81,14 @@ with gr.Blocks() as demo:
|
|
81 |
# 提交按鈕
|
82 |
submit_button = gr.Button("提交")
|
83 |
|
84 |
-
#
|
85 |
output_text = gr.Textbox(
|
86 |
label="模型回應",
|
87 |
placeholder="模型的回應將出現在這裡",
|
88 |
lines=10
|
89 |
)
|
90 |
-
|
91 |
-
label="
|
92 |
-
placeholder="下載的文件路徑",
|
93 |
interactive=False
|
94 |
)
|
95 |
|
@@ -98,10 +97,11 @@ with gr.Blocks() as demo:
|
|
98 |
text_response, file_path = generate_pdf_summary(api_key, pdf_file, prompt)
|
99 |
return text_response, file_path
|
100 |
|
|
|
101 |
submit_button.click(
|
102 |
handle_generate_summary,
|
103 |
inputs=[api_key_input, pdf_input, prompt],
|
104 |
-
outputs=[output_text,
|
105 |
)
|
106 |
|
107 |
# 啟動 Gradio 介面
|
|
|
81 |
# 提交按鈕
|
82 |
submit_button = gr.Button("提交")
|
83 |
|
84 |
+
# 輸出文字框和下載文件按鈕
|
85 |
output_text = gr.Textbox(
|
86 |
label="模型回應",
|
87 |
placeholder="模型的回應將出現在這裡",
|
88 |
lines=10
|
89 |
)
|
90 |
+
download_button = gr.File(
|
91 |
+
label="下載模型回應",
|
|
|
92 |
interactive=False
|
93 |
)
|
94 |
|
|
|
97 |
text_response, file_path = generate_pdf_summary(api_key, pdf_file, prompt)
|
98 |
return text_response, file_path
|
99 |
|
100 |
+
# 提交按鈕的處理
|
101 |
submit_button.click(
|
102 |
handle_generate_summary,
|
103 |
inputs=[api_key_input, pdf_input, prompt],
|
104 |
+
outputs=[output_text, download_button]
|
105 |
)
|
106 |
|
107 |
# 啟動 Gradio 介面
|