duongthienz commited on
Commit
a86d5c1
·
verified ·
1 Parent(s): f9d6ba7

Various visual changes according to 20260505 meeting

Browse files
Files changed (1) hide show
  1. app.py +23 -23
app.py CHANGED
@@ -147,6 +147,18 @@ with st.expander("Instructions and additional details"):
147
  st.write("4. Use the tabs to view different visualizations. Each can be downloaded.")
148
  st.write("4a. Graphs are built with [plotly](https://plotly.com/). Double-click to reset. [More examples](https://plotly.com/python/basic-charts/).")
149
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  # ---------------------------------------------------------------------------
151
  # File upload
152
  # ---------------------------------------------------------------------------
@@ -265,9 +277,9 @@ try:
265
  raise ValueError("File not yet analyzed")
266
 
267
  st.header(f"Analysis of file {currFile}")
268
- TAB_NAMES = ["Rename Speaker", "Roles", "Categories",
269
- "Treemap", "Timeline", "Time Spoken", "Download"]
270
- renameTab, pie2, sunburst1, treemap1, timeline, bar1, dataTab = st.tabs(TAB_NAMES)
271
 
272
  currAnnotation, currTotalTime = st.session_state.results[currFile]
273
  speakerNames = currAnnotation.labels()
@@ -363,7 +375,7 @@ try:
363
  displayDF = displayDF.sort_values("Start").reset_index(drop=True)
364
  csv = convert_df(displayDF)
365
  st.download_button(
366
- "Press to Download analysis data", csv,
367
  f"sonogram-analysis-{currPlainName}.csv", "text/csv",
368
  key="download-csv", on_click="ignore",
369
  )
@@ -371,13 +383,13 @@ try:
371
  analyzed_count = sum(
372
  1 for r in st.session_state.results.values() if len(r) == 2
373
  )
374
- if analyzed_count > 1:
375
- zip_bytes = build_all_csv_zip()
376
- st.download_button(
377
- "Download all analyzed files (.zip)", zip_bytes,
378
- "sonogram-analysis-all.zip", "application/zip",
379
- key="download-all-zip", on_click="ignore",
380
- )
381
 
382
  # -----------------------------------------------------------------------
383
  # Tab: Rename Speaker
@@ -444,18 +456,6 @@ except ValueError:
444
 
445
  ui.render_multifile_summary(PLOTLY_CONFIG)
446
 
447
- with st.expander("(Potentially) FAQ"):
448
- st.write("**1. I tried analyzing a file, but the page refreshed and nothing happened! Why?**")
449
- st.write("You may need to select a file using the sidebar on the left.")
450
- st.write("**2. I don't see a sidebar! Where is it?**")
451
- st.write("Press the '>' in the upper left to expand the sidebar.")
452
- st.write("**3. I still don't have a file to select in the dropdown! Why?**")
453
- st.write("Your file may be too large. We currently support approximately 1.5 hours of audio.")
454
- st.write("**4. I want to view my previously analyzed data. How?**")
455
- st.write("Download a CSV copy from the Download tab and re-upload it later.")
456
- st.write("**5. The app is extremely slow. What is wrong?**")
457
- st.write("We are securing funding for permanent GPU access. Until then, CPU analysis may take a very long time.")
458
-
459
  st.divider()
460
  st.write("Would you like additional data, charts, or features? [Tell us about our project!](https://forms.gle/A32CdfGYSZoMPyyX9)")
461
  st.write("If you would like to learn more or work with us, contact Dr. Mark Baillie at mtbaillie@ualr.edu")
 
147
  st.write("4. Use the tabs to view different visualizations. Each can be downloaded.")
148
  st.write("4a. Graphs are built with [plotly](https://plotly.com/). Double-click to reset. [More examples](https://plotly.com/python/basic-charts/).")
149
 
150
+ with st.expander("(Potentially) FAQ"):
151
+ st.write("**1. I tried analyzing a file, but the page refreshed and nothing happened! Why?**")
152
+ st.write("You may need to select a file using the sidebar on the left.")
153
+ st.write("**2. I don't see a sidebar! Where is it?**")
154
+ st.write("Press the '>' in the upper left to expand the sidebar.")
155
+ st.write("**3. I still don't have a file to select in the dropdown! Why?**")
156
+ st.write("Your file may be too large. We currently support approximately 1.5 hours of audio.")
157
+ st.write("**4. I want to view my previously analyzed data. How?**")
158
+ st.write("Download a CSV copy from the Download tab and re-upload it later.")
159
+ st.write("**5. The app is extremely slow. What is wrong?**")
160
+ st.write("We are securing funding for permanent GPU access. Until then, CPU analysis may take a very long time.")
161
+
162
  # ---------------------------------------------------------------------------
163
  # File upload
164
  # ---------------------------------------------------------------------------
 
277
  raise ValueError("File not yet analyzed")
278
 
279
  st.header(f"Analysis of file {currFile}")
280
+ TAB_NAMES = ["Speakers & Roles", "Pie Chart", "Sunburst",
281
+ "Treemap", "Time Spoken", "Timeline", "Download"]
282
+ renameTab, pie2, sunburst1, treemap1, bar1, timeline, dataTab = st.tabs(TAB_NAMES)
283
 
284
  currAnnotation, currTotalTime = st.session_state.results[currFile]
285
  speakerNames = currAnnotation.labels()
 
375
  displayDF = displayDF.sort_values("Start").reset_index(drop=True)
376
  csv = convert_df(displayDF)
377
  st.download_button(
378
+ f"Download {currPlainName}.csv", csv,
379
  f"sonogram-analysis-{currPlainName}.csv", "text/csv",
380
  key="download-csv", on_click="ignore",
381
  )
 
383
  analyzed_count = sum(
384
  1 for r in st.session_state.results.values() if len(r) == 2
385
  )
386
+ zip_bytes = build_all_csv_zip() if analyzed_count > 1 else b""
387
+ st.download_button(
388
+ "Download all analyzed data in .csv (.zip)", zip_bytes,
389
+ "sonogram-analysis-all.zip", "application/zip",
390
+ key="download-all-zip", on_click="ignore",
391
+ disabled=(analyzed_count <= 1),
392
+ )
393
 
394
  # -----------------------------------------------------------------------
395
  # Tab: Rename Speaker
 
456
 
457
  ui.render_multifile_summary(PLOTLY_CONFIG)
458
 
 
 
 
 
 
 
 
 
 
 
 
 
459
  st.divider()
460
  st.write("Would you like additional data, charts, or features? [Tell us about our project!](https://forms.gle/A32CdfGYSZoMPyyX9)")
461
  st.write("If you would like to learn more or work with us, contact Dr. Mark Baillie at mtbaillie@ualr.edu")