Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,59 +10,27 @@ def process_answers(
|
|
| 10 |
stress_level,
|
| 11 |
wellness_goals,
|
| 12 |
dietary_restrictions,
|
| 13 |
-
eating_habits,
|
| 14 |
relaxation_time,
|
| 15 |
health_issues,
|
| 16 |
-
stress_management,
|
| 17 |
-
daily_routine,
|
| 18 |
-
bedtime_routine,
|
| 19 |
water_intake,
|
| 20 |
-
mindfulness_frequency,
|
| 21 |
-
mindset,
|
| 22 |
-
personal_growth_reflection,
|
| 23 |
-
break_frequency,
|
| 24 |
-
relaxation_activities,
|
| 25 |
-
self_care_time,
|
| 26 |
-
outdoor_activity_frequency,
|
| 27 |
-
gratitude_practice,
|
| 28 |
-
home_cooked_meals,
|
| 29 |
-
uninterrupted_sleep,
|
| 30 |
gratitude_feelings,
|
| 31 |
connection_rating,
|
| 32 |
-
activity_tracking,
|
| 33 |
-
strength_training,
|
| 34 |
energy_rating
|
| 35 |
):
|
| 36 |
-
#
|
| 37 |
responses = {
|
| 38 |
-
questions[0]: sleep,
|
| 39 |
-
questions[1]: exercise,
|
| 40 |
-
questions[2]: mood,
|
| 41 |
-
questions[3]: stress_level,
|
| 42 |
-
questions[4]: wellness_goals,
|
| 43 |
-
questions[5]: dietary_restrictions,
|
| 44 |
-
questions[
|
| 45 |
-
questions[
|
| 46 |
-
questions[
|
| 47 |
-
questions[
|
| 48 |
-
questions[
|
| 49 |
-
questions[
|
| 50 |
-
questions[12]: water_intake,
|
| 51 |
-
questions[13]: mindfulness_frequency,
|
| 52 |
-
questions[14]: mindset,
|
| 53 |
-
questions[15]: personal_growth_reflection,
|
| 54 |
-
questions[16]: break_frequency,
|
| 55 |
-
questions[17]: relaxation_activities,
|
| 56 |
-
questions[18]: self_care_time,
|
| 57 |
-
questions[19]: outdoor_activity_frequency,
|
| 58 |
-
questions[20]: gratitude_practice,
|
| 59 |
-
questions[21]: home_cooked_meals,
|
| 60 |
-
questions[22]: uninterrupted_sleep,
|
| 61 |
-
questions[23]: gratitude_feelings,
|
| 62 |
-
questions[24]: connection_rating,
|
| 63 |
-
questions[25]: activity_tracking,
|
| 64 |
-
questions[26]: strength_training,
|
| 65 |
-
questions[27]: energy_rating
|
| 66 |
}
|
| 67 |
|
| 68 |
# Process responses using the centralized pipeline
|
|
@@ -71,7 +39,6 @@ def process_answers(
|
|
| 71 |
# Format outputs using results from the pipeline
|
| 72 |
wellness_report = f"**Wellness Report**\n------------------\n{results['report'].strip()}"
|
| 73 |
|
| 74 |
-
# Updated Identified Problems section to display eight new themes
|
| 75 |
identified_problems = (
|
| 76 |
"**Identified Problems**\n"
|
| 77 |
"-----------------------\n"
|
|
@@ -105,9 +72,23 @@ def process_answers(
|
|
| 105 |
|
| 106 |
return wellness_report, identified_problems, recommendations, summary_shown, final_summary_video
|
| 107 |
|
|
|
|
| 108 |
iface = gr.Interface(
|
| 109 |
fn=process_answers,
|
| 110 |
-
inputs=[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
outputs=[
|
| 112 |
gr.Markdown(label="Wellness Report"),
|
| 113 |
gr.Markdown(label="Identified Problems"),
|
|
|
|
| 10 |
stress_level,
|
| 11 |
wellness_goals,
|
| 12 |
dietary_restrictions,
|
|
|
|
| 13 |
relaxation_time,
|
| 14 |
health_issues,
|
|
|
|
|
|
|
|
|
|
| 15 |
water_intake,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
gratitude_feelings,
|
| 17 |
connection_rating,
|
|
|
|
|
|
|
| 18 |
energy_rating
|
| 19 |
):
|
| 20 |
+
# Map the selected responses to their corresponding questions
|
| 21 |
responses = {
|
| 22 |
+
questions[0]: sleep, # How many hours of sleep do you get each night?
|
| 23 |
+
questions[1]: exercise, # How often do you exercise in a week?
|
| 24 |
+
questions[2]: mood, # On a scale of 1 to 10, how would you rate your mood today?
|
| 25 |
+
questions[3]: stress_level, # What is your current stress level on a scale from 1 to 10?
|
| 26 |
+
questions[4]: wellness_goals, # What are your primary wellness goals?
|
| 27 |
+
questions[5]: dietary_restrictions, # Do you follow any specific diet or have any dietary restrictions?
|
| 28 |
+
questions[7]: relaxation_time, # How much time do you spend on relaxation or mindfulness activities daily?
|
| 29 |
+
questions[8]: health_issues, # Do you experience any recurring health issues or pain?
|
| 30 |
+
questions[12]: water_intake, # How much water do you drink on average per day?
|
| 31 |
+
questions[23]: gratitude_feelings, # How often do you experience feelings of gratitude or happiness?
|
| 32 |
+
questions[24]: connection_rating, # On a scale from 1 to 10, how connected do you feel to your friends and family?
|
| 33 |
+
questions[27]: energy_rating # On a scale from 1 to 10, how would you rate your energy levels throughout the day?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
}
|
| 35 |
|
| 36 |
# Process responses using the centralized pipeline
|
|
|
|
| 39 |
# Format outputs using results from the pipeline
|
| 40 |
wellness_report = f"**Wellness Report**\n------------------\n{results['report'].strip()}"
|
| 41 |
|
|
|
|
| 42 |
identified_problems = (
|
| 43 |
"**Identified Problems**\n"
|
| 44 |
"-----------------------\n"
|
|
|
|
| 72 |
|
| 73 |
return wellness_report, identified_problems, recommendations, summary_shown, final_summary_video
|
| 74 |
|
| 75 |
+
# Define the Gradio interface using only the 12 selected questions
|
| 76 |
iface = gr.Interface(
|
| 77 |
fn=process_answers,
|
| 78 |
+
inputs=[
|
| 79 |
+
gr.Textbox(label=questions[0]),
|
| 80 |
+
gr.Textbox(label=questions[1]),
|
| 81 |
+
gr.Textbox(label=questions[2]),
|
| 82 |
+
gr.Textbox(label=questions[3]),
|
| 83 |
+
gr.Textbox(label=questions[4]),
|
| 84 |
+
gr.Textbox(label=questions[5]),
|
| 85 |
+
gr.Textbox(label=questions[7]),
|
| 86 |
+
gr.Textbox(label=questions[8]),
|
| 87 |
+
gr.Textbox(label=questions[12]),
|
| 88 |
+
gr.Textbox(label=questions[23]),
|
| 89 |
+
gr.Textbox(label=questions[24]),
|
| 90 |
+
gr.Textbox(label=questions[27])
|
| 91 |
+
],
|
| 92 |
outputs=[
|
| 93 |
gr.Markdown(label="Wellness Report"),
|
| 94 |
gr.Markdown(label="Identified Problems"),
|