Download app.py from Rashi-jan/hellocute: direct link, hf CLI and curl.
- Browser
- Download file 2.22 kB
-
https://huggingface.co/spaces/Rashi-jan/hellocute/resolve/main/app.py
- Command line
-
hf download hf://spaces/Rashi-jan/hellocute/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Rashi-jan/hellocute/resolve/main/app.py
2.22 kB
| import gradio as gr | |
| # ----------------- FITNESS LOGIC ----------------- # | |
| def fitness_advice(goal, duration, equipment): | |
| """ | |
| Provides personalized fitness suggestions based on user input. | |
| """ | |
| advice = "๐๏ธโโ๏ธ Personalized Fitness Plan:\n\n" | |
| # Duration check | |
| if duration < 15: | |
| advice += "๐น Try short, high-intensity exercises like HIIT.\n" | |
| elif duration <= 45: | |
| advice += "๐น Moderate workout combining cardio and strength training.\n" | |
| else: | |
| advice += "๐น Long sessions: focus on endurance, strength, and flexibility.\n" | |
| # Goal-specific advice | |
| if goal.lower() == "weight loss": | |
| advice += "๐น Focus on cardio, HIIT, and full-body workouts.\n" | |
| elif goal.lower() == "muscle gain": | |
| advice += "๐น Focus on strength training, compound exercises, progressive overload.\n" | |
| elif goal.lower() == "flexibility": | |
| advice += "๐น Yoga, Pilates, and dynamic stretching are recommended.\n" | |
| else: | |
| advice += "๐น Mix cardio, strength, and flexibility for general fitness.\n" | |
| # Equipment | |
| if equipment.lower() in ["none", "bodyweight"]: | |
| advice += "๐น Use bodyweight exercises like push-ups, squats, planks.\n" | |
| else: | |
| advice += f"๐น Incorporate your {equipment} into your workouts.\n" | |
| advice += "\n๐ก Remember: consistency + proper diet = results!" | |
| return advice | |
| # ----------------- GRADIO UI ----------------- # | |
| with gr.Blocks(title="Physical Fitness Assistant") as demo: | |
| gr.Markdown("## ๐๏ธ Physical Fitness Assistant") | |
| gr.Markdown("Enter your fitness goals and preferences to get a personalized plan.") | |
| with gr.Row(): | |
| goal = gr.Dropdown(choices=["Weight Loss", "Muscle Gain", "Flexibility", "General Fitness"], label="Fitness Goal") | |
| duration = gr.Slider(minimum=10, maximum=120, step=5, label="Workout Duration (minutes)") | |
| equipment = gr.Textbox(label="Available Equipment (type 'None' for bodyweight)") | |
| output = gr.Textbox(label="Your Fitness Plan", lines=10) | |
| gr.Button("Get Fitness Plan").click( | |
| fn=fitness_advice, | |
| inputs=[goal, duration, equipment], | |
| outputs=output | |
| ) | |
| demo.launch() | |