Rashi-jan commited on
Commit
bc311ed
ยท
verified ยท
1 Parent(s): 3fa4858

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +56 -0
app.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ # ----------------- FITNESS LOGIC ----------------- #
4
+ def fitness_advice(goal, duration, equipment):
5
+ """
6
+ Provides personalized fitness suggestions based on user input.
7
+ """
8
+ advice = "๐Ÿ‹๏ธโ€โ™‚๏ธ Personalized Fitness Plan:\n\n"
9
+
10
+ # Duration check
11
+ if duration < 15:
12
+ advice += "๐Ÿ”น Try short, high-intensity exercises like HIIT.\n"
13
+ elif duration <= 45:
14
+ advice += "๐Ÿ”น Moderate workout combining cardio and strength training.\n"
15
+ else:
16
+ advice += "๐Ÿ”น Long sessions: focus on endurance, strength, and flexibility.\n"
17
+
18
+ # Goal-specific advice
19
+ if goal.lower() == "weight loss":
20
+ advice += "๐Ÿ”น Focus on cardio, HIIT, and full-body workouts.\n"
21
+ elif goal.lower() == "muscle gain":
22
+ advice += "๐Ÿ”น Focus on strength training, compound exercises, progressive overload.\n"
23
+ elif goal.lower() == "flexibility":
24
+ advice += "๐Ÿ”น Yoga, Pilates, and dynamic stretching are recommended.\n"
25
+ else:
26
+ advice += "๐Ÿ”น Mix cardio, strength, and flexibility for general fitness.\n"
27
+
28
+ # Equipment
29
+ if equipment.lower() in ["none", "bodyweight"]:
30
+ advice += "๐Ÿ”น Use bodyweight exercises like push-ups, squats, planks.\n"
31
+ else:
32
+ advice += f"๐Ÿ”น Incorporate your {equipment} into your workouts.\n"
33
+
34
+ advice += "\n๐Ÿ’ก Remember: consistency + proper diet = results!"
35
+ return advice
36
+
37
+
38
+ # ----------------- GRADIO UI ----------------- #
39
+ with gr.Blocks(title="Physical Fitness Assistant") as demo:
40
+ gr.Markdown("## ๐Ÿ‹๏ธ Physical Fitness Assistant")
41
+ gr.Markdown("Enter your fitness goals and preferences to get a personalized plan.")
42
+
43
+ with gr.Row():
44
+ goal = gr.Dropdown(choices=["Weight Loss", "Muscle Gain", "Flexibility", "General Fitness"], label="Fitness Goal")
45
+ duration = gr.Slider(minimum=10, maximum=120, step=5, label="Workout Duration (minutes)")
46
+ equipment = gr.Textbox(label="Available Equipment (type 'None' for bodyweight)")
47
+
48
+ output = gr.Textbox(label="Your Fitness Plan", lines=10)
49
+
50
+ gr.Button("Get Fitness Plan").click(
51
+ fn=fitness_advice,
52
+ inputs=[goal, duration, equipment],
53
+ outputs=output
54
+ )
55
+
56
+ demo.launch()