duongthienz commited on
Commit
147e0a8
·
verified ·
1 Parent(s): 1c285ce

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +5 -1
utils.py CHANGED
@@ -536,7 +536,7 @@ def build_fig_timeline(speakers_dataFrame, currTotalTime, speaker_color_map, get
536
  title="Timeline of audio with speakers",
537
  color_discrete_map=speaker_color_map,
538
  )
539
- fig.update_yaxes(autorange=True)
540
 
541
  # Add vertical shading for multi-voice intervals.
542
  # Note: add_vrect does not support hover tooltips in Plotly — this is a
@@ -616,6 +616,10 @@ def build_fig_bar(df2, speakerNames, catColors, speaker_color_map, get_display_n
616
  for sp in df2["names"]}
617
  disp_dark_map = {d: _darken_hex(c) for d, c in disp_color_map.items()}
618
 
 
 
 
 
619
  fig = go.Figure()
620
  for _, row in df2.iterrows():
621
  col = disp_color_map.get(row["display"], "#aaaaaa")
 
536
  title="Timeline of audio with speakers",
537
  color_discrete_map=speaker_color_map,
538
  )
539
+ fig.update_yaxes(autorange="reversed")
540
 
541
  # Add vertical shading for multi-voice intervals.
542
  # Note: add_vrect does not support hover tooltips in Plotly — this is a
 
616
  for sp in df2["names"]}
617
  disp_dark_map = {d: _darken_hex(c) for d, c in disp_color_map.items()}
618
 
619
+ # Sort descending so highest speaker is added first → top of chart,
620
+ # SPEAKER_001 added last → bottom, matching Timeline order.
621
+ df2 = df2.sort_values("names", ascending=False).reset_index(drop=True)
622
+
623
  fig = go.Figure()
624
  for _, row in df2.iterrows():
625
  col = disp_color_map.get(row["display"], "#aaaaaa")