srbhavya01 commited on
Commit
29e2e4b
·
verified ·
1 Parent(s): f352473

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -51
app.py CHANGED
@@ -1,78 +1,58 @@
1
  import streamlit as st
 
 
2
 
3
- st.markdown(
4
- """
5
- <style>
6
-
7
- .stApp{
8
- background-image: url("https://images.unsplash.com/photo-1554284126-aa88f22d8b74");
9
- background-size: cover;
10
- }
11
-
12
- h1{
13
- color:white;
14
- text-align:center;
15
- }
16
 
17
- </style>
18
- """,
19
- unsafe_allow_html=True
20
- )
21
  if "logged_in" not in st.session_state:
22
  st.session_state.logged_in = False
23
 
24
  if not st.session_state.logged_in:
25
  st.warning("Please login first")
26
  st.stop()
27
- # ---------- ADD EXTERNAL PATHS ----------
28
- sys.path.append(os.path.abspath("../model"))
29
- sys.path.append(os.path.abspath("../prompt"))
30
-
31
- if st.button("Logout"):
32
- st.session_state.logged_in = False
33
- st.experimental_rerun()
34
-
35
- # ---------- IMPORT YOUR FILES ----------
36
- from model_api import query_model
37
- from prompt_builder import build_prompt, calculate_bmi, bmi_category
38
-
39
-
40
- # ---------- STREAMLIT UI ----------
41
- st.title("🏋️ AI Personalized 5-Day Workout Planner")
42
 
43
  name = st.text_input("Name")
44
- age = st.number_input("Age", min_value=0, max_value=100)
 
45
  gender = st.selectbox("Gender", ["Male", "Female", "Other"])
46
 
47
- height = st.number_input("Height (cm)", min_value=0, max_value=250)
48
- weight = st.number_input("Weight (kg)", min_value=0, max_value=200)
49
 
50
- goal = st.selectbox("Fitness Goal",["Build Muscle", "Weight Loss", "Strength Gain", "Abs Building", "Flexible"])
 
 
 
51
 
52
- fitness_level = st.selectbox("Fitness Level", [
53
- "Beginner",
54
- "Intermediate",
55
- "Advanced"
56
- ])
57
 
58
  equipment = st.multiselect(
59
- "Available Equipment",
60
- ["Dumbbells", "Resistance Band", "Yoga Mat", "Skipping Rope",
61
- "Weight Plates", "Cycling", "Inclined Bench", "Pullups Bar", "No Equipment"]
 
 
 
 
 
 
 
62
  )
63
 
64
- # ---------- GENERATE PLAN ----------
65
  if st.button("Generate 5-Day Plan 💪"):
66
 
67
  prompt, bmi, bmi_status = build_prompt(
68
- name, age, gender, height, weight,
69
- goal, fitness_level, equipment
70
- )
71
 
72
- st.subheader(f"Your BMI: {bmi:.2f} ({bmi_status})")
73
 
74
- with st.spinner("Creating your personalized workout plan..."):
75
  result = query_model(prompt)
76
 
77
  st.markdown("## 🗓️ Your 5-Day Workout Plan")
78
- st.write(result)
 
1
  import streamlit as st
2
+ from model_api import query_model
3
+ from prompt_builder import build_prompt
4
 
5
+ st.title("🏋️ AI Personalized 5-Day Workout Planner")
 
 
 
 
 
 
 
 
 
 
 
 
6
 
 
 
 
 
7
  if "logged_in" not in st.session_state:
8
  st.session_state.logged_in = False
9
 
10
  if not st.session_state.logged_in:
11
  st.warning("Please login first")
12
  st.stop()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  name = st.text_input("Name")
15
+ age = st.number_input("Age", 10, 80)
16
+
17
  gender = st.selectbox("Gender", ["Male", "Female", "Other"])
18
 
19
+ height = st.number_input("Height (cm)", 100, 250)
20
+ weight = st.number_input("Weight (kg)", 30, 200)
21
 
22
+ goal = st.selectbox(
23
+ "Fitness Goal",
24
+ ["Build Muscle", "Weight Loss", "Strength Gain", "Abs Building", "Flexibility"]
25
+ )
26
 
27
+ fitness_level = st.selectbox(
28
+ "Fitness Level",
29
+ ["Beginner", "Intermediate", "Advanced"]
30
+ )
 
31
 
32
  equipment = st.multiselect(
33
+ "Equipment",
34
+ [
35
+ "Dumbbells",
36
+ "Resistance Band",
37
+ "Yoga Mat",
38
+ "Skipping Rope",
39
+ "Pullups Bar",
40
+ "Inclined Bench",
41
+ "Weight Plates"
42
+ ]
43
  )
44
 
 
45
  if st.button("Generate 5-Day Plan 💪"):
46
 
47
  prompt, bmi, bmi_status = build_prompt(
48
+ name, age, gender, height, weight,
49
+ goal, fitness_level, equipment
50
+ )
51
 
52
+ st.subheader(f"BMI: {bmi} ({bmi_status})")
53
 
54
+ with st.spinner("Generating workout plan..."):
55
  result = query_model(prompt)
56
 
57
  st.markdown("## 🗓️ Your 5-Day Workout Plan")
58
+ st.markdown(result)