Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
|
@@ -601,18 +601,22 @@ try:
|
|
| 601 |
st.sidebar.subheader("Rename Speakers")
|
| 602 |
st.sidebar.caption("Replace SPEAKER_## labels with real names.")
|
| 603 |
current_renames = st.session_state.speakerRenames[currFileIndex]
|
| 604 |
-
|
| 605 |
-
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
|
| 614 |
-
|
| 615 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 616 |
|
| 617 |
catTypeColors = su.colorsCSS(3)
|
| 618 |
allColors = su.colorsCSS(len(speakerNames)+len(st.session_state.categories))
|
|
@@ -957,8 +961,8 @@ try:
|
|
| 957 |
st.plotly_chart(fig2_la, use_container_width=True, config=config)
|
| 958 |
col6_1, col6_2 = st.columns(2)
|
| 959 |
try:
|
| 960 |
-
|
| 961 |
-
|
| 962 |
except Exception:
|
| 963 |
pass
|
| 964 |
with col6_1:
|
|
|
|
| 601 |
st.sidebar.subheader("Rename Speakers")
|
| 602 |
st.sidebar.caption("Replace SPEAKER_## labels with real names.")
|
| 603 |
current_renames = st.session_state.speakerRenames[currFileIndex]
|
| 604 |
+
with st.sidebar.form("rename_form"):
|
| 605 |
+
temp_renames = {}
|
| 606 |
+
for sp in speakerNames:
|
| 607 |
+
current_label = current_renames.get(sp, "")
|
| 608 |
+
temp_renames[sp] = st.text_input(
|
| 609 |
+
f"{sp}",
|
| 610 |
+
value=current_label,
|
| 611 |
+
placeholder="e.g. John",
|
| 612 |
+
)
|
| 613 |
+
if st.form_submit_button("Apply Names"):
|
| 614 |
+
for sp, new_name in temp_renames.items():
|
| 615 |
+
if new_name.strip():
|
| 616 |
+
st.session_state.speakerRenames[currFileIndex][sp] = new_name.strip()
|
| 617 |
+
elif sp in st.session_state.speakerRenames[currFileIndex]:
|
| 618 |
+
del st.session_state.speakerRenames[currFileIndex][sp]
|
| 619 |
+
st.rerun()
|
| 620 |
|
| 621 |
catTypeColors = su.colorsCSS(3)
|
| 622 |
allColors = su.colorsCSS(len(speakerNames)+len(st.session_state.categories))
|
|
|
|
| 961 |
st.plotly_chart(fig2_la, use_container_width=True, config=config)
|
| 962 |
col6_1, col6_2 = st.columns(2)
|
| 963 |
try:
|
| 964 |
+
fig2_la.write_image("ascn_bar.pdf")
|
| 965 |
+
fig2_la.write_image("ascn_bar.svg")
|
| 966 |
except Exception:
|
| 967 |
pass
|
| 968 |
with col6_1:
|