Spaces:
Running
Running
fix: Download button now works - removed broken .then() chain
Browse files- Made download button always enabled (removed interactive=False)
- Removed problematic .then() chain that wasn't enabling the button
- Simplified approach: button always available, works when clicked
- Download function validates content exists before generating file
- app.py +3 -12
- summary_20260201_121726.json +52 -0
app.py
CHANGED
|
@@ -1029,10 +1029,10 @@ def create_interface():
|
|
| 1029 |
with gr.Row():
|
| 1030 |
copy_summary_btn = gr.Button("📋 Copy Summary", size="sm")
|
| 1031 |
copy_thinking_btn = gr.Button("📋 Copy Thinking", size="sm")
|
| 1032 |
-
download_btn = gr.Button("⬇️ Download (JSON)", size="sm"
|
| 1033 |
|
| 1034 |
-
#
|
| 1035 |
-
download_output = gr.File(label="Download", visible=False)
|
| 1036 |
|
| 1037 |
# Event handlers
|
| 1038 |
submit_btn.click(
|
|
@@ -1040,15 +1040,6 @@ def create_interface():
|
|
| 1040 |
inputs=[file_input, model_dropdown, enable_reasoning, max_tokens, temperature_slider, top_p, top_k, language_selector],
|
| 1041 |
outputs=[thinking_output, summary_output, info_output, metrics_state],
|
| 1042 |
show_progress="full"
|
| 1043 |
-
).then(
|
| 1044 |
-
fn=lambda: gr.Button(interactive=True),
|
| 1045 |
-
outputs=[download_btn]
|
| 1046 |
-
)
|
| 1047 |
-
|
| 1048 |
-
model_dropdown.change(
|
| 1049 |
-
fn=update_reasoning_visibility,
|
| 1050 |
-
inputs=[model_dropdown],
|
| 1051 |
-
outputs=[enable_reasoning]
|
| 1052 |
)
|
| 1053 |
|
| 1054 |
# Copy buttons
|
|
|
|
| 1029 |
with gr.Row():
|
| 1030 |
copy_summary_btn = gr.Button("📋 Copy Summary", size="sm")
|
| 1031 |
copy_thinking_btn = gr.Button("📋 Copy Thinking", size="sm")
|
| 1032 |
+
download_btn = gr.Button("⬇️ Download (JSON)", size="sm")
|
| 1033 |
|
| 1034 |
+
# File output component for download
|
| 1035 |
+
download_output = gr.File(label="Download JSON", visible=False)
|
| 1036 |
|
| 1037 |
# Event handlers
|
| 1038 |
submit_btn.click(
|
|
|
|
| 1040 |
inputs=[file_input, model_dropdown, enable_reasoning, max_tokens, temperature_slider, top_p, top_k, language_selector],
|
| 1041 |
outputs=[thinking_output, summary_output, info_output, metrics_state],
|
| 1042 |
show_progress="full"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1043 |
)
|
| 1044 |
|
| 1045 |
# Copy buttons
|
summary_20260201_121726.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"metadata": {
|
| 3 |
+
"generated_at": "2026-02-01T12:17:26.433841",
|
| 4 |
+
"model": "ERNIE-4.5 21B Thinking (128K Context)",
|
| 5 |
+
"model_id": "ernie_21b_thinking_q1",
|
| 6 |
+
"language": "zh-TW"
|
| 7 |
+
},
|
| 8 |
+
"thinking_process": "",
|
| 9 |
+
"summary": "我需要總結用戶提供的錄音內容。首先,我需要仔細分析每一部分的時間、講話者和文字內容,然後進行分鏈。\n\n首先,從起始時間0:00:11到0:01:59,講話者是SPEAKER_02,內容提到“請留方的資訊和資訊欄”多次重複“請留意下方的資訊櫚”。\n\n接著從0:02:16開始,相同句子再次出現。然後在0:05:42到0:06:19之間,講話者SPEAKER_01和SPEAKER_03加入新內容,提到“資訊欄”相關對話。\n\n從0:06:23開始,不同時間點的講話者(SPEAKER_00、SPEAKER_02)討論晶片供應情況、三星海力士策略、DDR記憶體技術比較,以及缺料持續到2028年的資訊。\n\n最後階段的對話集中在420等元素和Industry相關話題,時間從0:07:02到0:09:02結束,討論電話流程和業緣溝條件。\n\n我需要整理這些零散的對話片段,分類時期和主題,確保每個部分清晰呈現,不重複內容。最後將總結結果放入正式語境,如商業或技術討論。\n</think>\n\n<response>\n以下是根據提供錄音內容的總結:\n\n---\n**總結內容:**\n本錄音涉及多次時間點的對話,主要圍爛「資訊欄」相關主題,包含以下片段:\n1.**重複性「請留意下方資訊櫚」提醒** \n -0:00:11-0:01:59(SPEAKER_02單獨強調) \n -0:02:16-0:05:42(重複三次,含晶片供應策略探討) \n -0:06:23-0:07:02(SPEAKER_01/SPEAKER_03參與,討論資源競爭與技術細節)\n\n2.**技術議題分類** \n -0:05:42-0:06:19:DDR記憶體技術升級(HBM/LoparD5vsDDR4/DDR3)及供應鏈策略 \n -0:06:28-0:07:02:Industry資源競爭(三星海力士產能計劃、缺料持續至2028年) \n -0:07:44-0:08:25:電話流程議題(輾鏈機制與Industry空廠可能性)\n\n3.**人物互動總結** \n -SPEAKER_00(董事長)與SPEAKER_02(CEO)對談中探討決策機制 \n -Eagle角色介入電話會議,討論錶決策略與空廠條件 \n -時間衿暢導致話題碎片化,核心為資源競爭與技術升級議題。\n\n---\n這段錄音主要圍繞企業資源競爭(如晶片、記憶體產能)和技術策略展開,含多次「請留意下方資訊櫛」重複提醒,反映嚴謹的業務決策流程。\n</response>",
|
| 10 |
+
"generation_metrics": {
|
| 11 |
+
"settings_used": {
|
| 12 |
+
"model": "ernie_21b_thinking_q1",
|
| 13 |
+
"max_tokens": 2048,
|
| 14 |
+
"temperature": 0.6,
|
| 15 |
+
"top_p": 0.95,
|
| 16 |
+
"top_k": 20,
|
| 17 |
+
"repeat_penalty": 1.15,
|
| 18 |
+
"enable_reasoning": true,
|
| 19 |
+
"output_language": "zh-TW",
|
| 20 |
+
"n_ctx": 4096
|
| 21 |
+
},
|
| 22 |
+
"timing": {
|
| 23 |
+
"time_to_first_token_ms": 123488.45,
|
| 24 |
+
"total_processing_time_ms": 346693.1,
|
| 25 |
+
"model_load_time_ms": 352013.86
|
| 26 |
+
},
|
| 27 |
+
"tokens": {
|
| 28 |
+
"n_ctx": 4096,
|
| 29 |
+
"input_tokens": 1173,
|
| 30 |
+
"output_tokens": 747,
|
| 31 |
+
"thinking_tokens": 0,
|
| 32 |
+
"total_tokens": 1920,
|
| 33 |
+
"generation_tokens": 812,
|
| 34 |
+
"prefill_tokens": 1145
|
| 35 |
+
},
|
| 36 |
+
"performance": {
|
| 37 |
+
"generation_speed_tps": 2.34,
|
| 38 |
+
"prefill_speed_tps": 9.27
|
| 39 |
+
},
|
| 40 |
+
"file_info": {
|
| 41 |
+
"filename": "short.txt",
|
| 42 |
+
"size_bytes": 3436,
|
| 43 |
+
"original_char_count": 1604
|
| 44 |
+
},
|
| 45 |
+
"truncation_info": {
|
| 46 |
+
"was_truncated": false,
|
| 47 |
+
"original_char_count": 1604,
|
| 48 |
+
"final_char_count": 1604,
|
| 49 |
+
"original_token_estimate": 1145
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
}
|