Update app.py
Browse files
app.py
CHANGED
@@ -13,21 +13,33 @@ def mock_summary():
|
|
13 |
# 假資料模擬摘要
|
14 |
return "這份文件主要討論人工智慧在工作效率提升方面的應用,並提供了實際案例來說明其價值。"
|
15 |
|
|
|
|
|
|
|
|
|
16 |
with gr.Blocks() as demo:
|
17 |
gr.Markdown("# AI Notes Assistant")
|
18 |
-
gr.Markdown("**上傳文件並進行問答或摘要生成**")
|
19 |
-
|
20 |
-
with gr.Row():
|
21 |
-
upload = gr.File(label="上傳文件(目前僅支持模擬功能)")
|
22 |
-
|
23 |
-
with gr.Row():
|
24 |
-
question = gr.Textbox(label="提出問題,例如:文件的核心觀點是什麼?")
|
25 |
-
answer = gr.Textbox(label="回答", interactive=False)
|
26 |
-
ask_button = gr.Button("提問")
|
27 |
|
28 |
with gr.Row():
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
ask_button.click(mock_question_answer, inputs=[question], outputs=[answer])
|
33 |
summary_button.click(mock_summary, inputs=[], outputs=[summary])
|
|
|
13 |
# 假資料模擬摘要
|
14 |
return "這份文件主要討論人工智慧在工作效率提升方面的應用,並提供了實際案例來說明其價值。"
|
15 |
|
16 |
+
def mock_sources():
|
17 |
+
# 假資料模擬來源列表
|
18 |
+
return ["來源一:時間的四則問題", "來源二:新文章"]
|
19 |
+
|
20 |
with gr.Blocks() as demo:
|
21 |
gr.Markdown("# AI Notes Assistant")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
with gr.Row():
|
24 |
+
with gr.Column():
|
25 |
+
gr.Markdown("### 來源選單")
|
26 |
+
sources = gr.CheckboxGroup(
|
27 |
+
choices=mock_sources(), label="選取所有來源", interactive=True
|
28 |
+
)
|
29 |
+
|
30 |
+
with gr.Column():
|
31 |
+
gr.Markdown("### 對話區域")
|
32 |
+
question = gr.Textbox(label="提出問題,例如:文件的核心觀點是什麼?")
|
33 |
+
answer = gr.Textbox(label="回答", interactive=False)
|
34 |
+
ask_button = gr.Button("提問")
|
35 |
+
|
36 |
+
with gr.Column():
|
37 |
+
gr.Markdown("### 功能卡片")
|
38 |
+
with gr.Tab("摘要生成"):
|
39 |
+
summary_button = gr.Button("生成摘要")
|
40 |
+
summary = gr.Textbox(label="摘要", interactive=False)
|
41 |
+
with gr.Tab("其他功能"):
|
42 |
+
gr.Markdown("此處可以添加更多功能卡片")
|
43 |
|
44 |
ask_button.click(mock_question_answer, inputs=[question], outputs=[answer])
|
45 |
summary_button.click(mock_summary, inputs=[], outputs=[summary])
|