jaisun2004 commited on
Commit
c0c3e38
Β·
verified Β·
1 Parent(s): ccab464

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -37
app.py CHANGED
@@ -160,48 +160,48 @@ if uploaded_file:
160
  if os.path.exists(audio_path):
161
  os.remove(audio_path)
162
 
163
- tab1, tab2, tab3, tab4 = st.tabs(["πŸ“ Transcript", "πŸ“‹ Summary", "πŸ’¬ Emotions", "πŸ“ˆ Trends"])
164
 
165
  with tab1:
166
- st.subheader("πŸ“ Speaker-Simulated Transcript")
167
- if 'diarized_transcript' in locals():
168
- st.markdown(diarized_transcript, unsafe_allow_html=True)
169
- else:
170
- st.warning("Transcript not available.")
171
 
172
  with tab2:
173
- st.subheader("πŸ“‹ Contextual Summary")
174
- if 'summary' in locals():
175
-
176
- # Insight Tracking based on previous sessions
177
- insights = []
178
- if "music" in raw_transcript.lower():
179
- if any("walking" in s["coping"] for s in past_sessions):
180
- insights.append("Patient previously mentioned walking as a helpful coping mechanism. This time, music is highlighted instead.")
181
- if "sleep" in raw_transcript.lower():
182
- insights.append("Sleep continues to be a recurring theme across sessions.")
183
-
184
- final_output = f"{summary[0]['summary_text']}\n\nContextual Observations:\n" + "\n".join(insights)
185
- st.write(final_output)
186
- else:
187
- st.warning("Summary not available.")
188
 
189
  with tab3:
190
- st.subheader("πŸ’¬ Emotional Insights (Overall)")
191
- if 'emotion_scores' in locals():
192
- for emo in emotion_scores[0]:
193
- st.write(f"{emo['label']}: {round(emo['score']*100, 2)}%")
194
- else:
195
- st.warning("No emotional data to display.")
196
 
197
  with tab4:
198
- st.subheader("πŸ“ˆ Emotional Trends Over Time")
199
- session_dates = ["2024-04-01", "2024-04-08", "2024-04-15", "2024-04-22"]
200
- anxiety_scores = [70, 65, 55, 40]
201
- sadness_scores = [30, 20, 25, 15]
202
-
203
- fig = go.Figure()
204
- fig.add_trace(go.Scatter(x=session_dates, y=anxiety_scores, mode='lines+markers', name='Anxiety'))
205
- fig.add_trace(go.Scatter(x=session_dates, y=sadness_scores, mode='lines+markers', name='Sadness'))
206
- fig.update_layout(title='Emotional Trends', xaxis_title='Date', yaxis_title='Score (%)')
207
- st.plotly_chart(fig)
 
160
  if os.path.exists(audio_path):
161
  os.remove(audio_path)
162
 
163
+ tab1, tab2, tab3, tab4 = st.tabs(["πŸ“ Transcript", "πŸ“‹ Summary", "πŸ’¬ Emotions", "πŸ“ˆ Trends"])
164
 
165
  with tab1:
166
+ st.subheader("πŸ“ Speaker-Simulated Transcript")
167
+ if 'diarized_transcript' in locals():
168
+ st.markdown(diarized_transcript, unsafe_allow_html=True)
169
+ else:
170
+ st.warning("Transcript not available.")
171
 
172
  with tab2:
173
+ st.subheader("πŸ“‹ Contextual Summary")
174
+ if 'summary' in locals():
175
+
176
+ # Insight Tracking based on previous sessions
177
+ insights = []
178
+ if "music" in raw_transcript.lower():
179
+ if any("walking" in s["coping"] for s in past_sessions):
180
+ insights.append("Patient previously mentioned walking as a helpful coping mechanism. This time, music is highlighted instead.")
181
+ if "sleep" in raw_transcript.lower():
182
+ insights.append("Sleep continues to be a recurring theme across sessions.")
183
+
184
+ final_output = f"{summary[0]['summary_text']}\n\nContextual Observations:\n" + "\n".join(insights)
185
+ st.write(final_output)
186
+ else:
187
+ st.warning("Summary not available.")
188
 
189
  with tab3:
190
+ st.subheader("πŸ’¬ Emotional Insights (Overall)")
191
+ if 'emotion_scores' in locals():
192
+ for emo in emotion_scores[0]:
193
+ st.write(f"{emo['label']}: {round(emo['score']*100, 2)}%")
194
+ else:
195
+ st.warning("No emotional data to display.")
196
 
197
  with tab4:
198
+ st.subheader("πŸ“ˆ Emotional Trends Over Time")
199
+ session_dates = ["2024-04-01", "2024-04-08", "2024-04-15", "2024-04-22"]
200
+ anxiety_scores = [70, 65, 55, 40]
201
+ sadness_scores = [30, 20, 25, 15]
202
+
203
+ fig = go.Figure()
204
+ fig.add_trace(go.Scatter(x=session_dates, y=anxiety_scores, mode='lines+markers', name='Anxiety'))
205
+ fig.add_trace(go.Scatter(x=session_dates, y=sadness_scores, mode='lines+markers', name='Sadness'))
206
+ fig.update_layout(title='Emotional Trends', xaxis_title='Date', yaxis_title='Score (%)')
207
+ st.plotly_chart(fig)