duongthienz commited on
Commit
1c285ce
·
verified ·
1 Parent(s): 408fcce

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +3 -4
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="reversed")
540
 
541
  # Add vertical shading for multi-voice intervals.
542
  # Note: add_vrect does not support hover tooltips in Plotly — this is a
@@ -617,8 +617,7 @@ def build_fig_bar(df2, speakerNames, catColors, speaker_color_map, get_display_n
617
  disp_dark_map = {d: _darken_hex(c) for d, c in disp_color_map.items()}
618
 
619
  fig = go.Figure()
620
- # Iterate in reverse so SPEAKER_001 is added last → appears at bottom
621
- for _, row in df2.iloc[::-1].iterrows():
622
  col = disp_color_map.get(row["display"], "#aaaaaa")
623
  fig.add_trace(go.Bar(
624
  x=[row["sv_secs"]], y=[row["display"]], orientation="h",
@@ -626,7 +625,7 @@ def build_fig_bar(df2, speakerNames, catColors, speaker_color_map, get_display_n
626
  customdata=[[row["display"], row["time_label"], row["mv_time_label"]]],
627
  hovertemplate="<b>%{customdata[0]}</b><br>Total: %{customdata[1]}<br>Multi Voice: %{customdata[2]}<extra></extra>",
628
  ))
629
- for _, row in df2.iloc[::-1].iterrows():
630
  if row["mv_secs"] <= 0:
631
  continue
632
  dark = disp_dark_map.get(row["display"], "#555555")
 
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
 
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")
622
  fig.add_trace(go.Bar(
623
  x=[row["sv_secs"]], y=[row["display"]], orientation="h",
 
625
  customdata=[[row["display"], row["time_label"], row["mv_time_label"]]],
626
  hovertemplate="<b>%{customdata[0]}</b><br>Total: %{customdata[1]}<br>Multi Voice: %{customdata[2]}<extra></extra>",
627
  ))
628
+ for _, row in df2.iterrows():
629
  if row["mv_secs"] <= 0:
630
  continue
631
  dark = disp_dark_map.get(row["display"], "#555555")