duongthienz commited on
Commit
8941973
·
verified ·
1 Parent(s): d563a76

Make the tableDF container scrollable

Browse files
Files changed (1) hide show
  1. app.py +29 -27
app.py CHANGED
@@ -488,33 +488,35 @@ try:
488
  # so we only show it once (on the first row for that speaker).
489
  rendered_clip_for: set = set()
490
 
491
- for _, row in tableDF.iterrows():
492
- row_cols = st.columns(col_widths)
493
- display_sp = row["Speaker"]
494
-
495
- # Map display name back to original SPEAKER_## for clip lookup
496
- raw_key = next(
497
- (sp for sp in speakerNames if raw_to_display.get(sp, sp) == display_sp),
498
- display_sp,
499
- )
500
-
501
- row_cols[0].write(display_sp)
502
- for i, col_name in enumerate(other_cols):
503
- row_cols[i + 1].write(row[col_name])
504
-
505
- if has_extras:
506
- if raw_key in file_clips and raw_key not in rendered_clip_for:
507
- rendered_clip_for.add(raw_key)
508
- row_cols[-2].audio(file_clips[raw_key], format="audio/wav")
509
- sp_segs = st.session_state.speakerSegments.get(currFile, {}).get(raw_key, [])
510
- if has_waveform and sp_segs:
511
- if row_cols[-1].button(
512
- "🔀",
513
- key=f"randomize_{currFile}_{raw_key}",
514
- help="Try a different clip for this speaker",
515
- ):
516
- randomize_speaker_clip(currFile, raw_key)
517
- st.rerun()
 
 
518
 
519
  # -----------------------------------------------------------------------
520
  # Charts (pie1, pie2, sunburst, treemap, timeline, bar)
 
488
  # so we only show it once (on the first row for that speaker).
489
  rendered_clip_for: set = set()
490
 
491
+ # ~52px per row gives roughly 10 visible rows before scrolling
492
+ with st.container(height=520, border=False):
493
+ for _, row in tableDF.iterrows():
494
+ row_cols = st.columns(col_widths)
495
+ display_sp = row["Speaker"]
496
+
497
+ # Map display name back to original SPEAKER_## for clip lookup
498
+ raw_key = next(
499
+ (sp for sp in speakerNames if raw_to_display.get(sp, sp) == display_sp),
500
+ display_sp,
501
+ )
502
+
503
+ row_cols[0].write(display_sp)
504
+ for i, col_name in enumerate(other_cols):
505
+ row_cols[i + 1].write(row[col_name])
506
+
507
+ if has_extras:
508
+ if raw_key in file_clips and raw_key not in rendered_clip_for:
509
+ rendered_clip_for.add(raw_key)
510
+ row_cols[-2].audio(file_clips[raw_key], format="audio/wav")
511
+ sp_segs = st.session_state.speakerSegments.get(currFile, {}).get(raw_key, [])
512
+ if has_waveform and sp_segs:
513
+ if row_cols[-1].button(
514
+ "🔀",
515
+ key=f"randomize_{currFile}_{raw_key}",
516
+ help="Try a different clip for this speaker",
517
+ ):
518
+ randomize_speaker_clip(currFile, raw_key)
519
+ st.rerun()
520
 
521
  # -----------------------------------------------------------------------
522
  # Charts (pie1, pie2, sunburst, treemap, timeline, bar)