File size: 1,530 Bytes
8c98a6a
 
7ba7c55
8c98a6a
 
 
7ba7c55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8c98a6a
7ba7c55
8c98a6a
7ba7c55
 
 
 
8c98a6a
7ba7c55
 
8c98a6a
7ba7c55
 
8c98a6a
7ba7c55
8c98a6a
7ba7c55
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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.")