js02vel commited on
Commit
932419d
·
verified ·
1 Parent(s): e2e6a31

Delete src

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +0 -169
src/streamlit_app.py DELETED
@@ -1,169 +0,0 @@
1
- import streamlit as st
2
- from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
3
- import torch
4
-
5
- # 1. Basic Configuration
6
- st.set_page_config(page_title="FitPlan AI", page_icon="💪", layout="centered")
7
-
8
- def load_model():
9
- tokenizer = AutoTokenizer.from_pretrained("google/flan-t5-base")
10
- model = AutoModelForSeq2SeqLM.from_pretrained("google/flan-t5-base")
11
- return tokenizer, model
12
-
13
- tokenizer, model = load_model()
14
-
15
- generator = load_model()
16
- # 2. Enhanced CSS
17
- st.markdown("""
18
- <style>
19
- /* Full Page Background */
20
- [data-testid="stAppViewContainer"] {
21
- background: linear-gradient(rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.75)),
22
- url("https://images.unsplash.com/photo-1517836357463-d25dfeac3438?q=80&w=2070&auto=format&fit=crop");
23
- background-size: cover;
24
- background-position: center;
25
- background-attachment: fixed;
26
- }
27
- /* Hide the "Press Enter to submit form" hint globally */
28
- [data-testid="InputInstructions"] {
29
- display: none !important;
30
- }
31
- /* Form Container Polish */
32
- div[data-testid="stForm"] {
33
- background-color: rgba(255, 255, 255, 0.98) !important;
34
- padding: 3rem !important;
35
- border-radius: 20px !important;
36
- border: none !important;
37
- box-shadow: 0 15px 35px rgba(0,0,0,0.5);
38
- }
39
- /* --- FONT SIZE UPDATES --- */
40
- /* Main Title (FitPlan AI) */
41
- .main-title {
42
- color: #FFFFFF !important;
43
- font-size: 60px !important;
44
- font-weight: 850 !important;
45
- text-align: center;
46
- margin-bottom: 0px;
47
- text-shadow: 3px 3px 6px rgba(0,0,0,0.9);
48
- font-family: 'Helvetica Neue', sans-serif;
49
- }
50
- /* Subtitle (Your personalized gym companion) */
51
- .sub-title {
52
- color: #E0E0E0 !important;
53
- font-size: 24px !important;
54
- text-align: center;
55
- margin-top: -10px;
56
- margin-bottom: 40px;
57
- font-style: italic;
58
- text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
59
- }
60
- /* Form Section Headers (Orange) */
61
- .form-header {
62
- color: #f97316 !important;
63
- font-size: 22px !important;
64
- font-weight: bold !important;
65
- text-transform: uppercase;
66
- letter-spacing: 1px;
67
- }
68
- /* Labels for inputs */
69
- label p {
70
- font-size: 18px !important;
71
- color: #1e293b !important;
72
- font-weight: 600 !important;
73
- }
74
- /* Button Styling */
75
- .stButton > button {
76
- width: 100%;
77
- background: linear-gradient(90deg, #f97316, #ea580c) !important;
78
- color: white !important;
79
- font-size: 20px !important;
80
- font-weight: bold !important;
81
- height: 3.5rem !important;
82
- border-radius: 12px !important;
83
- border: none !important;
84
- margin-top: 20px;
85
- }
86
- </style>
87
- """, unsafe_allow_html=True)
88
-
89
- # --------------------------------------------------
90
- # UI Header Section
91
- # --------------------------------------------------
92
- st.markdown('<p class="main-title">💪 FitPlan AI</p>', unsafe_allow_html=True)
93
- st.markdown('<p class="sub-title">Your personalized gym companion</p>', unsafe_allow_html=True)
94
-
95
- # --------------------------------------------------
96
- # Fitness Profile Form
97
- # --------------------------------------------------
98
- with st.form("fitness_form", clear_on_submit=False):
99
- st.markdown('<p class="form-header">🧍‍♂️ 1. PERSONAL INFORMATION</p>', unsafe_allow_html=True)
100
-
101
- name = st.text_input("Full Name *", placeholder="Enter your full name")
102
-
103
- col1, col2 = st.columns(2)
104
- with col1:
105
- height = st.number_input("Height (cm) *", min_value=0.0, step=1.0, value=0.0)
106
- with col2:
107
- weight = st.number_input("Weight (kg) *", min_value=0.0, step=0.1, value=0.0)
108
-
109
- st.markdown("<br>", unsafe_allow_html=True)
110
- st.markdown('<p class="form-header">🏋️ 2. FITNESS DETAILS</p>', unsafe_allow_html=True)
111
-
112
- goal = st.selectbox("Fitness Goal", ["Build Muscle", "Weight Loss", "Strength Gain", "Abs Building", "Flexible"])
113
-
114
- equipment = st.multiselect("Available Equipment",
115
- ["Dumbbells", "Resistance Band", "Yoga Mat", "Kettlebell", "Pull-up Bar", "No Equipment"],
116
- default=["No Equipment"])
117
-
118
- level = st.radio("Fitness Level", ["Beginner", "Intermediate", "Advanced"], horizontal=True)
119
-
120
- # SUBMIT BUTTON
121
- if st.button(" Submit Profile"):
122
-
123
- if not name:
124
- st.error("Please enter your name.")
125
-
126
- elif height <= 0 or weight <= 0:
127
- st.error("Please enter valid height and weight.")
128
-
129
- elif not equipment:
130
- st.error("Please select at least one equipment option.")
131
-
132
- else:
133
- st.success(" Profile Submitted Successfully!")
134
-
135
- bmi_status = bmi_category(bmi)
136
- equipment_list = ", ".join(equipment)
137
-
138
- prompt = f"""
139
- You are a certified professional fitness trainer.
140
-
141
- Create a detailed 5-day workout plan.
142
-
143
- User Information:
144
- - Gender: {gender}
145
- - BMI: {bmi:.2f} ({bmi_status})
146
- - Goal: {goal}
147
- - Fitness Level: {fitness_level}
148
- - Equipment Available: {equipment_list}
149
-
150
- Start directly with:
151
-
152
- Day 1:
153
- """
154
-
155
- with st.spinner("Generating your AI workout plan..."):
156
-
157
- inputs = tokenizer(prompt, return_tensors="pt", truncation=True)
158
-
159
- outputs = model.generate(
160
- **inputs,
161
- max_new_tokens=900,
162
- temperature=0.7,
163
- do_sample=True
164
- )
165
-
166
- result = tokenizer.decode(outputs[0], skip_special_tokens=True).strip()
167
-
168
- st.subheader(" Your Personalized Workout Plan")
169
- st.write(result)