Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,8 +10,16 @@ client = Groq(api_key=groq_api_key)
|
|
10 |
# Function to fetch personalized advice using Groq API
|
11 |
def get_personalized_advice(user_data):
|
12 |
"""Fetch personalized advice using the Groq API based on user data."""
|
13 |
-
query = f"
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
try:
|
16 |
response = client.chat.completions.create(
|
17 |
messages=[{"role": "user", "content": query}],
|
|
|
10 |
# Function to fetch personalized advice using Groq API
|
11 |
def get_personalized_advice(user_data):
|
12 |
"""Fetch personalized advice using the Groq API based on user data."""
|
13 |
+
query = f"""
|
14 |
+
Based on the following user's responses:
|
15 |
+
- Anxiety level: {user_data['anxiety_level']}
|
16 |
+
- Self-esteem: {user_data['self_esteem']}
|
17 |
+
- Mental health history: {user_data['mental_health_history']}
|
18 |
+
- Stress level: {user_data['stress_level']}
|
19 |
+
|
20 |
+
Please provide personalized mental health advice tailored to these responses.
|
21 |
+
"""
|
22 |
+
|
23 |
try:
|
24 |
response = client.chat.completions.create(
|
25 |
messages=[{"role": "user", "content": query}],
|