Spaces:
Sleeping
Sleeping
Add a new cross-file chart
Browse files
ui.py
CHANGED
|
@@ -428,4 +428,38 @@ def render_multifile_summary(plotly_config=None):
|
|
| 428 |
title=f"Cross-file Voice Categories sorted by {selected_sort}",
|
| 429 |
)
|
| 430 |
fig7.update_layout(yaxis_title="Proportion of File Duration")
|
| 431 |
-
st.plotly_chart(fig7, use_container_width=True, config=cfg)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 428 |
title=f"Cross-file Voice Categories sorted by {selected_sort}",
|
| 429 |
)
|
| 430 |
fig7.update_layout(yaxis_title="Proportion of File Duration")
|
| 431 |
+
st.plotly_chart(fig7, use_container_width=True, config=cfg)
|
| 432 |
+
|
| 433 |
+
st.divider()
|
| 434 |
+
|
| 435 |
+
# New chart: Single Voice broken down by role, plus Multi Voice and No Voice
|
| 436 |
+
df8, role_voice_cols = utils.build_multifile_role_voice_df(
|
| 437 |
+
validNames, st.session_state.results, st.session_state.summaries,
|
| 438 |
+
st.session_state.categories, st.session_state.categorySelect,
|
| 439 |
+
speakerRenames=st.session_state.speakerRenames,
|
| 440 |
+
)
|
| 441 |
+
# Build sort options dynamically from available columns
|
| 442 |
+
role_sort_options = {}
|
| 443 |
+
for col in role_voice_cols:
|
| 444 |
+
if col in ("Multi Voice", "No Voice"):
|
| 445 |
+
role_sort_options[f"{col} (most → least)"] = ([col], False)
|
| 446 |
+
else:
|
| 447 |
+
role_sort_options[f"{col} (least → most)"] = ([col], True)
|
| 448 |
+
|
| 449 |
+
selected_role_sort = st.selectbox(
|
| 450 |
+
"Sort cross-file role/voice breakdown by:",
|
| 451 |
+
options=list(role_sort_options.keys()),
|
| 452 |
+
key="multifile_role_voice_sort",
|
| 453 |
+
)
|
| 454 |
+
sort_cols8, ascending8 = role_sort_options[selected_role_sort]
|
| 455 |
+
fig8 = px.bar(
|
| 456 |
+
df8.sort_values(by=sort_cols8, ascending=ascending8),
|
| 457 |
+
x="files", y=role_voice_cols,
|
| 458 |
+
title=f"Cross-file Role & Voice Breakdown sorted by {selected_role_sort}",
|
| 459 |
+
)
|
| 460 |
+
fig8.update_layout(yaxis_title="Proportion of File Duration")
|
| 461 |
+
st.plotly_chart(fig8, use_container_width=True, config=cfg)
|
| 462 |
+
st.caption(
|
| 463 |
+
"*Note: Role proportions use union of speaker segments (overlaps counted once). "
|
| 464 |
+
"Multi Voice and No Voice are proportions of total file duration."
|
| 465 |
+
)
|