luigi-liu-tw commited on
Commit
08ce86f
Β·
1 Parent(s): 613fc2a
Files changed (1) hide show
  1. src/streamlit_app.py +12 -12
src/streamlit_app.py CHANGED
@@ -403,7 +403,7 @@ with tab3:
403
  elif not st.session_state.get('transcription_in_progress', False):
404
  with transcript_placeholder.container():
405
  st.info("No transcript available. Click 'Transcribe Audio' to generate one.")
406
-
407
  # ===== Summarization Process =====
408
  if st.button("πŸ“ Generate Summary", key="summarize_button_tab3"):
409
  if st.session_state.transcript:
@@ -412,11 +412,14 @@ with tab3:
412
  st.session_state.summary = ""
413
 
414
  try:
415
- # Create a dedicated container for live summary updates
416
- summary_display = st.container()
417
 
418
- # Show live summary header and placeholder
419
- with summary_display:
 
 
 
420
  st.markdown("### πŸ“ Live Summary (In Progress)")
421
  progress_placeholder = st.empty()
422
 
@@ -435,13 +438,10 @@ with tab3:
435
  duration = time.time() - start_time
436
  debug_log(f"Summary completed: {char_count} chars in {duration:.1f}s", "INFO")
437
 
438
- # Clear the entire live summary section
439
- summary_display.empty()
440
-
441
- # βœ… Clear previous summary before showing new one
442
- summary_container.empty()
443
 
444
- # Now render the final summary cleanly
445
  with summary_container:
446
  st.markdown("### πŸ“ Final Summary")
447
  st.markdown(st.session_state.summary)
@@ -452,6 +452,6 @@ with tab3:
452
  debug_log(f"Summarization failed: {str(e)}", "ERROR")
453
  status_placeholder.error(f"Summary error: {str(e)}")
454
  else:
455
- status_placeholder.warning("⚠️ No transcript available")
456
 
457
  debug_log("Tab3 rendering completed", "STATE")
 
403
  elif not st.session_state.get('transcription_in_progress', False):
404
  with transcript_placeholder.container():
405
  st.info("No transcript available. Click 'Transcribe Audio' to generate one.")
406
+
407
  # ===== Summarization Process =====
408
  if st.button("πŸ“ Generate Summary", key="summarize_button_tab3"):
409
  if st.session_state.transcript:
 
412
  st.session_state.summary = ""
413
 
414
  try:
415
+ # βœ… Clear any existing summary content before starting
416
+ summary_container.empty()
417
 
418
+ # Use a temporary placeholder for live summary updates (outside summary_container)
419
+ live_summary_area = st.empty()
420
+
421
+ # Show live summary header and content inside the temporary area
422
+ with live_summary_area:
423
  st.markdown("### πŸ“ Live Summary (In Progress)")
424
  progress_placeholder = st.empty()
425
 
 
438
  duration = time.time() - start_time
439
  debug_log(f"Summary completed: {char_count} chars in {duration:.1f}s", "INFO")
440
 
441
+ # βœ… Clear the live summary area completely
442
+ live_summary_area.empty()
 
 
 
443
 
444
+ # βœ… Now show only the final summary in summary_container
445
  with summary_container:
446
  st.markdown("### πŸ“ Final Summary")
447
  st.markdown(st.session_state.summary)
 
452
  debug_log(f"Summarization failed: {str(e)}", "ERROR")
453
  status_placeholder.error(f"Summary error: {str(e)}")
454
  else:
455
+ status_placeholder.warning("⚠️ No transcript available")
456
 
457
  debug_log("Tab3 rendering completed", "STATE")