Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
|
2 |
import streamlit as st
|
3 |
import matplotlib.pyplot as plt
|
4 |
from transformers import pipeline
|
@@ -127,33 +126,34 @@ if uploaded_file:
|
|
127 |
os.remove(audio_path)
|
128 |
|
129 |
# --- Post-processing UI Layout ---
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
import matplotlib.pyplot as plt
|
3 |
from transformers import pipeline
|
|
|
126 |
os.remove(audio_path)
|
127 |
|
128 |
# --- Post-processing UI Layout ---
|
129 |
+
if 'diarized_transcript' in locals() and 'final_output' in locals() and 'emotion_scores' in locals():
|
130 |
+
tab1, tab2, tab3, tab4 = st.tabs(["π Transcript", "π Summary", "π¬ Emotions", "π Trends"])
|
131 |
+
|
132 |
+
with tab1:
|
133 |
+
st.subheader("π Transcript")
|
134 |
+
st.markdown(diarized_transcript, unsafe_allow_html=True)
|
135 |
+
|
136 |
+
with tab2:
|
137 |
+
st.subheader("π Contextual Summary")
|
138 |
+
st.write(final_output)
|
139 |
+
|
140 |
+
with tab3:
|
141 |
+
st.subheader("π¬ Emotional Insights (Overall)")
|
142 |
+
for emo in emotion_scores[0]:
|
143 |
+
st.write(f"{emo['label']}: {round(emo['score']*100, 2)}%")
|
144 |
+
|
145 |
+
with tab4:
|
146 |
+
st.subheader("π Emotional Trends Over Time")
|
147 |
+
|
148 |
+
session_dates = ["2024-04-01", "2024-04-08", "2024-04-15", "2024-04-22"]
|
149 |
+
anxiety_scores = [70, 65, 55, 40]
|
150 |
+
sadness_scores = [30, 20, 25, 15]
|
151 |
+
|
152 |
+
fig, ax = plt.subplots()
|
153 |
+
ax.plot(session_dates, anxiety_scores, label='Anxiety', marker='o')
|
154 |
+
ax.plot(session_dates, sadness_scores, label='Sadness', marker='o')
|
155 |
+
ax.set_title("Emotional Trends Over Time")
|
156 |
+
ax.set_ylabel("Score (%)")
|
157 |
+
ax.set_xlabel("Session Date")
|
158 |
+
ax.legend()
|
159 |
+
st.pyplot(fig)
|