-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmood_logger.py
More file actions
38 lines (29 loc) · 1.19 KB
/
Copy pathmood_logger.py
File metadata and controls
38 lines (29 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import streamlit as st
from datetime import datetime
st.set_page_config(page_title="Mood Insights 📊", page_icon="📈")
st.title("📈 MoodMate – Mood Insights Dashboard")
st.write("Explore how you’ve been feeling recently 💫")
# Load mood logs
try:
df = pd.read_csv("data/mood_logs.csv")
# Convert timestamp to datetime
df['timestamp'] = pd.to_datetime(df['timestamp'])
# Show latest entries
st.subheader("📝 Recent Conversations")
st.dataframe(df.tail(10))
# Plot mood frequency over time
df['date'] = df['timestamp'].dt.date
st.subheader("📅 Mood Usage Over Time")
mood_counts = df.groupby("date").size()
st.line_chart(mood_counts)
# Word frequency cloud (optional)
st.subheader("💭 Frequently Used Words")
all_text = " ".join(df['user_input'].dropna().astype(str))
from wordcloud import WordCloud
wc = WordCloud(width=800, height=300, background_color='white').generate(all_text)
st.image(wc.to_array())
except FileNotFoundError:
st.error("Mood logs not found. Use MoodMate to record interactions first.")