Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Fix an issue where selecting sort list causing an auto scroll downward
Browse files
ui.py
CHANGED
|
@@ -411,24 +411,25 @@ def render_multifile_summary(plotly_config=None):
|
|
| 411 |
"are only counted once."
|
| 412 |
)
|
| 413 |
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
|
|
|
| 432 |
|
| 433 |
st.divider()
|
| 434 |
|
|
@@ -438,28 +439,24 @@ def render_multifile_summary(plotly_config=None):
|
|
| 438 |
st.session_state.categories, st.session_state.categorySelect,
|
| 439 |
speakerRenames=st.session_state.speakerRenames,
|
| 440 |
)
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 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 |
-
)
|
|
|
|
| 411 |
"are only counted once."
|
| 412 |
)
|
| 413 |
|
| 414 |
+
with st.container():
|
| 415 |
+
sort_options = {
|
| 416 |
+
"Single Voice (least β most)": (["Single Voice", "Multi Voice"], True),
|
| 417 |
+
"Multi Voice (least β most)": (["Multi Voice", "Single Voice"], True),
|
| 418 |
+
"No Voice (most β least)": (["No Voice", "Multi Voice"], False),
|
| 419 |
+
}
|
| 420 |
+
selected_sort = st.selectbox(
|
| 421 |
+
"Sort cross-file voice categories by:",
|
| 422 |
+
options=list(sort_options.keys()),
|
| 423 |
+
key="multifile_voice_sort",
|
| 424 |
+
)
|
| 425 |
+
sort_cols, ascending = sort_options[selected_sort]
|
| 426 |
+
fig7 = px.bar(
|
| 427 |
+
df7.sort_values(by=sort_cols, ascending=ascending),
|
| 428 |
+
x="files", y=["Single Voice", "Multi Voice", "No Voice"],
|
| 429 |
+
title=f"Cross-file Voice Categories sorted by {selected_sort}",
|
| 430 |
+
)
|
| 431 |
+
fig7.update_layout(yaxis_title="Proportion of File Duration")
|
| 432 |
+
st.plotly_chart(fig7, use_container_width=True, config=cfg)
|
| 433 |
|
| 434 |
st.divider()
|
| 435 |
|
|
|
|
| 439 |
st.session_state.categories, st.session_state.categorySelect,
|
| 440 |
speakerRenames=st.session_state.speakerRenames,
|
| 441 |
)
|
| 442 |
+
with st.container():
|
| 443 |
+
role_sort_options = {}
|
| 444 |
+
for col in role_voice_cols:
|
| 445 |
+
if col in ("Multi Voice", "No Voice"):
|
| 446 |
+
role_sort_options[f"{col} (most β least)"] = ([col], False)
|
| 447 |
+
else:
|
| 448 |
+
role_sort_options[f"{col} (least β most)"] = ([col], True)
|
| 449 |
+
|
| 450 |
+
selected_role_sort = st.selectbox(
|
| 451 |
+
"Sort cross-file role/voice breakdown by:",
|
| 452 |
+
options=list(role_sort_options.keys()),
|
| 453 |
+
key="multifile_role_voice_sort",
|
| 454 |
+
)
|
| 455 |
+
sort_cols8, ascending8 = role_sort_options[selected_role_sort]
|
| 456 |
+
fig8 = px.bar(
|
| 457 |
+
df8.sort_values(by=sort_cols8, ascending=ascending8),
|
| 458 |
+
x="files", y=role_voice_cols,
|
| 459 |
+
title=f"Cross-file Role & Voice Breakdown sorted by {selected_role_sort}",
|
| 460 |
+
)
|
| 461 |
+
fig8.update_layout(yaxis_title="Proportion of File Duration")
|
| 462 |
+
st.plotly_chart(fig8, use_container_width=True, config=cfg)
|
|
|
|
|
|
|
|
|
|
|
|