Spaces:
Sleeping
Sleeping
Download app.py from Snehagkudur-01/Module_2_FitPlanAI: direct link, hf CLI and curl.
- Browser
- Download file 1.53 kB
-
https://huggingface.co/spaces/Snehagkudur-01/Module_2_FitPlanAI/resolve/main/app.py
- Command line
-
hf download hf://spaces/Snehagkudur-01/Module_2_FitPlanAI/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Snehagkudur-01/Module_2_FitPlanAI/resolve/main/app.py
1.53 kB
| import streamlit as st | |
| from model_api import query_model | |
| from prompt_builder import build_prompt | |
| st.set_page_config(page_title="FitPlan AI", layout="centered") | |
| st.title("๐๏ธ FitPlan AI โ Personalized Workout Generator") | |
| # ---------------- INPUT ---------------- # | |
| name = st.text_input("Enter Your Name") | |
| gender = st.radio("Gender", ["Male", "Female"]) | |
| height = st.number_input("Height (cm)", min_value=100.0, max_value=250.0) | |
| weight = st.number_input("Weight (kg)", min_value=30.0, max_value=200.0) | |
| goal = st.selectbox( | |
| "Fitness Goal", | |
| ["Build Muscle", "Lose Weight", "Improve Endurance", "General Fitness"] | |
| ) | |
| fitness_level = st.radio( | |
| "Fitness Level", | |
| ["Beginner", "Intermediate", "Advanced"] | |
| ) | |
| equipment = st.multiselect( | |
| "Available Equipment", | |
| [ | |
| "No Equipment", "Dumbbells", "Barbell", | |
| "Pull-up Bar", "Resistance Bands", | |
| "Treadmill", "Kettlebells", "Full Gym" | |
| ] | |
| ) | |
| # ---------------- GENERATE ---------------- # | |
| if st.button("Generate Workout Plan"): | |
| if height > 0 and weight > 0: | |
| prompt, bmi, bmi_status = build_prompt( | |
| name, gender, height, weight, | |
| goal, fitness_level, equipment | |
| ) | |
| with st.spinner("Generating your personalized plan..."): | |
| response = query_model(prompt) | |
| st.subheader("๐ Your Personalized Workout Plan") | |
| st.write(response) | |
| st.info(f"Calculated BMI: {bmi:.2f} ({bmi_status})") | |
| else: | |
| st.warning("Please enter valid height and weight.") |