jaisun2004 commited on
Commit
dd61bc2
Β·
verified Β·
1 Parent(s): c12bb4b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -58,7 +58,7 @@ if uploaded_file:
58
  ]
59
  rag_context = "\n".join([f"Session {i+1}: {s['coping']}, {s['emotion']}, {s['notes']}" for i, s in enumerate(past_sessions)])
60
  prompt_input = f"""Previous session context:\n{rag_context}\n\nCurrent session:\n{raw_transcript}"""
61
- summary = summarizer(prompt_input, max_length=256, min_length=60, do_sample=False)
62
 
63
  # Emotion tagging
64
  st.info("🎭 Extracting emotional tones...")
@@ -74,16 +74,16 @@ if uploaded_file:
74
  with tab2:
75
  st.subheader("πŸ“‹ Contextual Summary")
76
 
77
- # Insight Tracking based on previous sessions
78
- insights = []
79
- if "music" in raw_transcript.lower():
80
- if any("walking" in s["coping"] for s in past_sessions):
81
- insights.append("Patient previously mentioned walking as a helpful coping mechanism. This time, music is highlighted instead.")
82
- if "sleep" in raw_transcript.lower():
83
- insights.append("Sleep continues to be a recurring theme across sessions.")
84
-
85
- final_output = f"{summary[0]['summary_text']}\n\nContextual Observations:\n" + "\n".join(insights)
86
- st.write(final_output)
87
 
88
  with tab3:
89
  st.subheader("πŸ’¬ Emotional Insights (Overall)")
 
58
  ]
59
  rag_context = "\n".join([f"Session {i+1}: {s['coping']}, {s['emotion']}, {s['notes']}" for i, s in enumerate(past_sessions)])
60
  prompt_input = f"""Previous session context:\n{rag_context}\n\nCurrent session:\n{raw_transcript}"""
61
+ summary = summarizer(prompt_input, max_length=256, min_length=60, do_sample=False)
62
 
63
  # Emotion tagging
64
  st.info("🎭 Extracting emotional tones...")
 
74
  with tab2:
75
  st.subheader("πŸ“‹ Contextual Summary")
76
 
77
+ # Insight Tracking based on previous sessions
78
+ insights = []
79
+ if "music" in raw_transcript.lower():
80
+ if any("walking" in s["coping"] for s in past_sessions):
81
+ insights.append("Patient previously mentioned walking as a helpful coping mechanism. This time, music is highlighted instead.")
82
+ if "sleep" in raw_transcript.lower():
83
+ insights.append("Sleep continues to be a recurring theme across sessions.")
84
+
85
+ final_output = f"{summary[0]['summary_text']}\n\nContextual Observations:\n" + "\n".join(insights)
86
+ st.write(final_output)
87
 
88
  with tab3:
89
  st.subheader("πŸ’¬ Emotional Insights (Overall)")