jaisun2004 commited on
Commit
99efa15
Β·
verified Β·
1 Parent(s): e60f9dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -27
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import streamlit as st
2
  import plotly.graph_objects as go
3
  from transformers import pipeline
@@ -56,7 +57,7 @@ if uploaded_file:
56
  emotion_scores = emotion_model(raw_transcript)
57
 
58
  # Layout with Tabs
59
- tab1, tab2, tab3 = st.tabs(["πŸ“ Transcript", "πŸ“‹ Summary", "πŸ’¬ Emotions"])
60
 
61
  with tab1:
62
  st.subheader("πŸ“ Speaker-Simulated Transcript")
@@ -67,7 +68,21 @@ if uploaded_file:
67
  st.write(summary[0]["summary_text"])
68
 
69
  with tab3:
70
- st.subheader("πŸ’¬ Emotional Insights (Overall)")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  for emo in emotion_scores[0]:
72
  st.write(f"{emo['label']}: {round(emo['score']*100, 2)}%")
73
 
@@ -124,28 +139,3 @@ if uploaded_file:
124
  finally:
125
  if os.path.exists(audio_path):
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
- fig = go.Figure()
148
- fig.add_trace(go.Scatter(x=session_dates, y=anxiety_scores, mode='lines+markers', name='Anxiety'))
149
- fig.add_trace(go.Scatter(x=session_dates, y=sadness_scores, mode='lines+markers', name='Sadness'))
150
- fig.update_layout(title='Emotional Trends', xaxis_title='Date', yaxis_title='Score (%)')
151
- st.plotly_chart(fig)
 
1
+
2
  import streamlit as st
3
  import plotly.graph_objects as go
4
  from transformers import pipeline
 
57
  emotion_scores = emotion_model(raw_transcript)
58
 
59
  # Layout with Tabs
60
+ tab1, tab2, tab3 = tab1, tab2, tab3, tab4 = st.tabs(["πŸ“ Transcript", "πŸ“‹ Summary", "πŸ’¬ Emotions", "πŸ“ˆ Trends"])
61
 
62
  with tab1:
63
  st.subheader("πŸ“ Speaker-Simulated Transcript")
 
68
  st.write(summary[0]["summary_text"])
69
 
70
  with tab3:
71
+
72
+ with tab4:
73
+ st.subheader("πŸ“ˆ Emotional Trends Over Time")
74
+
75
+ session_dates = ["2024-04-01", "2024-04-08", "2024-04-15", "2024-04-22"]
76
+ anxiety_scores = [70, 65, 55, 40]
77
+ sadness_scores = [30, 20, 25, 15]
78
+
79
+ fig = go.Figure()
80
+ fig.add_trace(go.Scatter(x=session_dates, y=anxiety_scores, mode='lines+markers', name='Anxiety'))
81
+ fig.add_trace(go.Scatter(x=session_dates, y=sadness_scores, mode='lines+markers', name='Sadness'))
82
+ fig.update_layout(title='Emotional Trends', xaxis_title='Date', yaxis_title='Score (%)')
83
+ st.plotly_chart(fig)
84
+
85
+ st.subheader("πŸ’¬ Emotional Insights (Overall)")
86
  for emo in emotion_scores[0]:
87
  st.write(f"{emo['label']}: {round(emo['score']*100, 2)}%")
88
 
 
139
  finally:
140
  if os.path.exists(audio_path):
141
  os.remove(audio_path)