jaisun2004 commited on
Commit
fa44fcd
Β·
verified Β·
1 Parent(s): 101c614

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -31
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
- 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)
 
 
 
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)