duongthienz commited on
Commit
e465678
·
verified ·
1 Parent(s): 5775715

update time spoken w multi

Browse files
Files changed (1) hide show
  1. app.py +23 -4
app.py CHANGED
@@ -48,8 +48,8 @@ PLOTLY_CONFIG = {"displayModeBar": True, "modeBarButtonsToRemove": []}
48
  PARQUET_DATASET_DIR = Path("parquet_dataset")
49
  PARQUET_DATASET_DIR.mkdir(parents=True, exist_ok=True)
50
 
51
- DEMO_PATH = "sample.rttm"
52
- DEMO_SAMPLE_PATH = "sample_short.rttm"
53
  MULTI_DEMO_PATHS = [
54
  f"audioSamples/class{i:02d}.rttm" for i in range(1, 11)
55
  ]
@@ -96,7 +96,7 @@ if not (pipeline.isGPU or pipeline.isTPU):
96
 
97
  DEMO_VIDEO_URL = "https://www.youtube.com/watch?v=n7Z_BzU7yOY"
98
 
99
- with st.expander("TLDR"):
100
  st.write("Please watch this video for a walkthrough of this app:")
101
  st.video(DEMO_VIDEO_URL)
102
  st.write(
@@ -123,7 +123,7 @@ with st.expander("Instructions and additional details"):
123
  st.write("4. Use the tabs to view different visualizations. Each can be downloaded.")
124
  st.write("4a. Graphs are built with [plotly](https://plotly.com/). Double-click to reset. [More examples](https://plotly.com/python/basic-charts/).")
125
 
126
- with st.expander("(Potentially) FAQ"):
127
  st.write("**1. I tried analyzing a file, but the page refreshed and nothing happened! Why?**")
128
  st.write("You may need to select a file using the sidebar on the left.")
129
  st.write("**2. I don't see a sidebar! Where is it?**")
@@ -467,6 +467,25 @@ try:
467
  f"sonogram-speaker-categories-{currPlainName}.svg",
468
  "download-pdf3", "download-svg3", PLOTLY_CONFIG,
469
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
470
  ui.render_chart(
471
  utils.build_fig_treemap(df5, catTypeColors, speaker_color_map, get_display_name, currFile),
472
  treemap1,
 
48
  PARQUET_DATASET_DIR = Path("parquet_dataset")
49
  PARQUET_DATASET_DIR.mkdir(parents=True, exist_ok=True)
50
 
51
+ DEMO_PATH = "audioSamples/sample.rttm"
52
+ DEMO_SAMPLE_PATH = "audioSamples/sample_short.rttm"
53
  MULTI_DEMO_PATHS = [
54
  f"audioSamples/class{i:02d}.rttm" for i in range(1, 11)
55
  ]
 
96
 
97
  DEMO_VIDEO_URL = "https://www.youtube.com/watch?v=n7Z_BzU7yOY"
98
 
99
+ with st.expander("TL;DR"):
100
  st.write("Please watch this video for a walkthrough of this app:")
101
  st.video(DEMO_VIDEO_URL)
102
  st.write(
 
123
  st.write("4. Use the tabs to view different visualizations. Each can be downloaded.")
124
  st.write("4a. Graphs are built with [plotly](https://plotly.com/). Double-click to reset. [More examples](https://plotly.com/python/basic-charts/).")
125
 
126
+ with st.expander("Preliminary FAQ"):
127
  st.write("**1. I tried analyzing a file, but the page refreshed and nothing happened! Why?**")
128
  st.write("You may need to select a file using the sidebar on the left.")
129
  st.write("**2. I don't see a sidebar! Where is it?**")
 
467
  f"sonogram-speaker-categories-{currPlainName}.svg",
468
  "download-pdf3", "download-svg3", PLOTLY_CONFIG,
469
  )
470
+ with sunburst1:
471
+ sv_pct = df5.loc[df5["ids"] == "OV", "percentiles"].values
472
+ mv_pct = df5.loc[df5["ids"] == "MV", "percentiles"].values
473
+ sv_nonzero = len(sv_pct) > 0 and sv_pct[0] > 0
474
+ mv_nonzero = len(mv_pct) > 0 and mv_pct[0] > 0
475
+ # Only render individual charts if BOTH categories are non-zero.
476
+ # If either is 0%, the individual chart would be identical to the
477
+ # combination sunburst, so skip both to avoid redundancy.
478
+ if sv_nonzero and mv_nonzero:
479
+ fig_sun_single = utils.build_fig_sunburst_single(
480
+ df5, speaker_color_map, get_display_name, currFile)
481
+ if fig_sun_single is not None:
482
+ st.plotly_chart(fig_sun_single, use_container_width=True,
483
+ config=PLOTLY_CONFIG)
484
+ fig_sun_multi = utils.build_fig_sunburst_multi(
485
+ df5, speaker_color_map, get_display_name, currFile)
486
+ if fig_sun_multi is not None:
487
+ st.plotly_chart(fig_sun_multi, use_container_width=True,
488
+ config=PLOTLY_CONFIG)
489
  ui.render_chart(
490
  utils.build_fig_treemap(df5, catTypeColors, speaker_color_map, get_display_name, currFile),
491
  treemap1,