adityaardak commited on
Commit
bc540af
Β·
verified Β·
1 Parent(s): 059725c

Upload 13 files

Browse files
README.md CHANGED
@@ -1,33 +1,14 @@
1
- ---
2
- title: Serein Mind
3
- sdk: gradio
4
- emoji: πŸ¦€
5
- colorFrom: indigo
6
- colorTo: blue
7
- pinned: true
8
- sdk_version: 5.16.0
9
- ---
10
- # 🧠 Gradio-Based Mental Health App
11
-
12
- A mental health support application built using **Gradio**. This app provides multiple interactive features to help users manage their mental health.
13
-
14
- ---
15
-
16
- ## πŸš€ Features
17
- - πŸ“ **Blog Corner**: Share anonymous posts & upvote content.
18
- - πŸ“Š **Mood Tracker**: Log daily emotions & view trends.
19
- - 🎡 **Music Therapy**: AI-powered song recommendations based on mood.
20
- - 🎨 **Art Therapy**: Express emotions through a digital drawing canvas.
21
- - 🧘 **Meditation & Yoga**: Guided relaxation & mindfulness sessions.
22
- - πŸ’¬ **Community Sessions**: Live chat & moderated group discussions.
23
-
24
- ---
25
-
26
- ## βš™οΈ **Setup Instructions**
27
-
28
- ### **1️⃣ Install Dependencies**
29
- Make sure you have Python installed (version **3.8 or higher**).
30
- Then, install the required dependencies:
31
-
32
- ```bash
33
- pip install -r requirements.txt
 
1
+ # Gradio-Based Mental Health App
2
+ A mental health support application built using Gradio.
3
+
4
+ ## Features
5
+ - πŸ“ Blog Corner: Anonymous posts with upvotes/comments
6
+ - πŸ“Š Mood Tracker: Log emotions, visualize trends
7
+ - 🎡 Music Therapy: AI-based song recommendations
8
+ - 🎨 Art Therapy: Digital drawing canvas
9
+ - 🧘 Meditation & Yoga: Guided relaxation sessions
10
+ - πŸ’¬ Community Sessions: Live chat & group discussions
11
+
12
+ ## Setup
13
+ 1. Install dependencies: `pip install gradio pandas`
14
+ 2. Run the app: `python app.py`
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
modules/art_therapy.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def draw_canvas():
4
+ return "Save function not implemented yet!"
5
+
6
+ def main():
7
+ return gr.Interface(
8
+ fn=draw_canvas,
9
+ inputs=gr.Sketchpad(),
10
+ outputs="text"
11
+ )
modules/blog_corner.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import sqlite3
3
+
4
+ DB_FILE = "blog.db"
5
+
6
+ def create_table():
7
+ conn = sqlite3.connect(DB_FILE)
8
+ cursor = conn.cursor()
9
+ cursor.execute("CREATE TABLE IF NOT EXISTS posts (id INTEGER PRIMARY KEY, content TEXT, upvotes INTEGER)")
10
+ conn.commit()
11
+ conn.close()
12
+
13
+ def add_post(content):
14
+ conn = sqlite3.connect(DB_FILE)
15
+ cursor = conn.cursor()
16
+ cursor.execute("INSERT INTO posts (content, upvotes) VALUES (?, ?)", (content, 0))
17
+ conn.commit()
18
+ conn.close()
19
+ return "Post added successfully!"
20
+
21
+ def get_posts():
22
+ conn = sqlite3.connect(DB_FILE)
23
+ cursor = conn.cursor()
24
+ cursor.execute("SELECT id, content, upvotes FROM posts ORDER BY upvotes DESC")
25
+ posts = cursor.fetchall()
26
+ conn.close()
27
+ return "\n\n".join([f"πŸ“Œ {post[1]} - πŸ‘ {post[2]}" for post in posts])
28
+
29
+ def main():
30
+ create_table()
31
+ return gr.Interface(
32
+ fn=add_post,
33
+ inputs=gr.Textbox(label="Share your thoughts anonymously"),
34
+ outputs=gr.Text(label="Status"),
35
+ live=True
36
+ ).update(fn=get_posts, outputs=gr.Textbox(label="Community Posts"))
modules/community_sessions.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import sqlite3
3
+
4
+ DB_FILE = "community_chat.db"
5
+
6
+ def create_chat_table():
7
+ conn = sqlite3.connect(DB_FILE)
8
+ cursor = conn.cursor()
9
+ cursor.execute("CREATE TABLE IF NOT EXISTS chat (message TEXT)")
10
+ conn.commit()
11
+ conn.close()
12
+
13
+ def add_message(message):
14
+ conn = sqlite3.connect(DB_FILE)
15
+ cursor = conn.cursor()
16
+ cursor.execute("INSERT INTO chat (message) VALUES (?)", (message,))
17
+ conn.commit()
18
+ conn.close()
19
+ return "Message sent!"
20
+
21
+ def get_messages():
22
+ conn = sqlite3.connect(DB_FILE)
23
+ cursor = conn.cursor()
24
+ cursor.execute("SELECT message FROM chat")
25
+ messages = cursor.fetchall()
26
+ conn.close()
27
+ return "\n".join([f"πŸ—¨ {msg[0]}" for msg in messages])
28
+
29
+ def main():
30
+ create_chat_table()
31
+ return gr.Interface(
32
+ fn=add_message,
33
+ inputs=gr.Textbox(label="Enter your message"),
34
+ outputs="text",
35
+ live=True
36
+ ).update(fn=get_messages, outputs=gr.Textbox(label="Live Chat"))
modules/meditation_yoga.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ YOGA_VIDEOS = {
4
+ "Beginner Meditation": "https://www.youtube.com/watch?v=inpok4MKVLM",
5
+ "Yoga for Relaxation": "https://www.youtube.com/watch?v=v7AYKMP6rOE",
6
+ }
7
+
8
+ def get_video(choice):
9
+ return YOGA_VIDEOS[choice]
10
+
11
+ def main():
12
+ return gr.Interface(
13
+ fn=get_video,
14
+ inputs=gr.Dropdown(list(YOGA_VIDEOS.keys()), label="Choose a guided session"),
15
+ outputs=gr.Video(),
16
+ )
modules/mood_tracker.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import pandas as pd
3
+ import datetime
4
+
5
+ MOOD_OPTIONS = ["πŸ˜€ Happy", "😐 Neutral", "😒 Sad", "😠 Angry", "😞 Stressed"]
6
+ LOG_FILE = "mood_logs.csv"
7
+
8
+ def log_mood(mood):
9
+ with open(LOG_FILE, "a") as file:
10
+ file.write(f"{datetime.date.today()},{mood}\n")
11
+ return "Mood logged successfully!"
12
+
13
+ def get_mood_trends():
14
+ try:
15
+ df = pd.read_csv(LOG_FILE, names=["Date", "Mood"])
16
+ mood_counts = df["Mood"].value_counts().to_dict()
17
+ return mood_counts
18
+ except:
19
+ return "No mood data available."
20
+
21
+ def main():
22
+ return gr.Interface(
23
+ fn=log_mood,
24
+ inputs=gr.Radio(MOOD_OPTIONS, label="How are you feeling today?"),
25
+ outputs="text",
26
+ live=True
27
+ ).update(fn=get_mood_trends, outputs="label")
modules/music_therapy.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ MUSIC_RECOMMENDATIONS = {
4
+ "πŸ˜€ Happy": "https://www.youtube.com/watch?v=ZbZSe6N_BXs",
5
+ "😐 Neutral": "https://www.youtube.com/watch?v=JGwWNGJdvx8",
6
+ "😒 Sad": "https://www.youtube.com/watch?v=09R8_2nJtjg",
7
+ "😠 Angry": "https://www.youtube.com/watch?v=YQHsXMglC9A",
8
+ "😞 Stressed": "https://www.youtube.com/watch?v=VJ2rlci9PE0"
9
+ }
10
+
11
+ def recommend_music(mood):
12
+ return MUSIC_RECOMMENDATIONS[mood]
13
+
14
+ def main():
15
+ return gr.Interface(
16
+ fn=recommend_music,
17
+ inputs=gr.Radio(list(MUSIC_RECOMMENDATIONS.keys()), label="Select your mood"),
18
+ outputs=gr.Video(),
19
+ )
requirements.txt CHANGED
@@ -1,3 +1 @@
1
- gradio
2
- pandas
3
- matplotlib
 
1
+ matplotlib