Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
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 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
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)")
|