Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,11 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
import streamlit.components.v1 as components
|
| 3 |
import json
|
| 4 |
import hashlib
|
| 5 |
import re
|
| 6 |
from prompt_builder import build_prompt
|
| 7 |
from model_api import query_model
|
| 8 |
|
| 9 |
-
# ================= PAGE CONFIG =================
|
| 10 |
st.set_page_config(page_title="FitPlan Pro", layout="wide", initial_sidebar_state="collapsed")
|
| 11 |
|
| 12 |
# ================= USER DATABASE =================
|
|
@@ -29,169 +28,256 @@ def hash_password(password):
|
|
| 29 |
# ================= SESSION STATE =================
|
| 30 |
if "logged_in" not in st.session_state:
|
| 31 |
st.session_state.logged_in = False
|
| 32 |
-
if "
|
| 33 |
-
st.session_state.
|
| 34 |
|
| 35 |
-
# =================
|
| 36 |
-
def
|
| 37 |
-
# Hide Streamlit UI for full-screen professional look
|
| 38 |
st.markdown("""
|
| 39 |
-
<style>
|
| 40 |
-
header, footer, [data-testid="stToolbar"] {visibility: hidden;}
|
| 41 |
-
.block-container { padding: 0 !important; margin: 0 !important; max-width: 100% !important; }
|
| 42 |
-
iframe { display: block; width: 100vw; height: 100vh; border: none; }
|
| 43 |
-
</style>
|
| 44 |
-
""", unsafe_allow_html=True)
|
| 45 |
-
|
| 46 |
-
is_login = st.session_state.auth_mode == "login"
|
| 47 |
-
|
| 48 |
-
# YOUR EXACT UI INTEGRATED WITH WORKING JS
|
| 49 |
-
auth_html = f"""
|
| 50 |
-
<!DOCTYPE html>
|
| 51 |
-
<html lang="en">
|
| 52 |
-
<head>
|
| 53 |
-
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
|
| 54 |
<style>
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
</style>
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
</div>
|
| 84 |
-
<div class="
|
| 85 |
-
|
| 86 |
-
<div class="card"><
|
| 87 |
-
<div class="card"><
|
| 88 |
</div>
|
| 89 |
</div>
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
<
|
| 97 |
-
<
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
</div>
|
| 106 |
-
|
| 107 |
-
<script>
|
| 108 |
-
function sendAction(action) {{
|
| 109 |
-
const email = document.getElementById('email').value;
|
| 110 |
-
const pass = document.getElementById('pass').value;
|
| 111 |
-
// The magic bridge: pushing data to parent URL
|
| 112 |
-
const url = new URL(window.parent.location.href);
|
| 113 |
-
url.searchParams.set('auth_action', action);
|
| 114 |
-
url.searchParams.set('u', email);
|
| 115 |
-
url.searchParams.set('p', pass);
|
| 116 |
-
url.searchParams.set('ts', Date.now()); // forces detection
|
| 117 |
-
window.parent.location.href = url.href;
|
| 118 |
-
}}
|
| 119 |
-
</script>
|
| 120 |
-
</body>
|
| 121 |
-
</html>
|
| 122 |
-
"""
|
| 123 |
-
|
| 124 |
-
components.html(auth_html, height=720)
|
| 125 |
-
|
| 126 |
-
# PROCESS THE PUSHED DATA FROM THE BUTTONS
|
| 127 |
-
params = st.query_params
|
| 128 |
-
if "auth_action" in params:
|
| 129 |
-
action = params["auth_action"]
|
| 130 |
-
email, password = params.get("u"), params.get("p")
|
| 131 |
-
|
| 132 |
-
if action == "toggle":
|
| 133 |
-
st.session_state.auth_mode = "signup" if is_login else "login"
|
| 134 |
-
st.query_params.clear()
|
| 135 |
-
st.rerun()
|
| 136 |
-
|
| 137 |
-
elif action == "submit":
|
| 138 |
-
users = load_users()
|
| 139 |
-
if is_login:
|
| 140 |
if email in users and users[email] == hash_password(password):
|
| 141 |
st.session_state.logged_in = True
|
| 142 |
-
st.query_params.clear()
|
| 143 |
st.rerun()
|
| 144 |
else:
|
| 145 |
-
st.error("Invalid
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
save_users(users)
|
| 151 |
-
st.success("Account Created!
|
| 152 |
-
st.session_state.
|
| 153 |
-
st.query_params.clear()
|
| 154 |
st.rerun()
|
| 155 |
|
| 156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 157 |
def dashboard():
|
|
|
|
| 158 |
st.markdown("""
|
| 159 |
<style>
|
| 160 |
.stApp {
|
| 161 |
background: linear-gradient(rgba(0,0,0,0.9), rgba(0,0,0,0.9)),
|
| 162 |
url("https://images.unsplash.com/photo-1534438327276-14e5300c3a48?q=80&w=2070");
|
| 163 |
-
background-size: cover;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
}
|
| 165 |
-
h1, h2, h3, label, p, span { color: #FFFFFF !important; font-weight: 700 !important; text-transform: uppercase; }
|
| 166 |
-
div.stButton > button { width: 100% !important; background-color: #e60000 !important; color: white !important; font-weight: 900 !important; height: 50px !important; border-radius: 10px !important; }
|
| 167 |
-
.workout-container { background: rgba(255, 255, 255, 0.05); padding: 20px; border-radius: 10px; border-left: 5px solid #FFFFFF; color: #FFFFFF; }
|
| 168 |
</style>
|
| 169 |
""", unsafe_allow_html=True)
|
| 170 |
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
|
| 176 |
-
tab1, tab2 = st.tabs(["π PROFILE", "π WORKOUT"])
|
| 177 |
with tab1:
|
| 178 |
-
|
| 179 |
col1, col2 = st.columns(2)
|
| 180 |
-
|
| 181 |
-
with
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
|
| 191 |
with tab2:
|
| 192 |
-
if
|
| 193 |
-
st.
|
|
|
|
|
|
|
| 194 |
st.markdown(f'<div class="workout-container">{st.session_state.workout_plan}</div>', unsafe_allow_html=True)
|
|
|
|
|
|
|
| 195 |
|
| 196 |
# ================= ROUTER =================
|
| 197 |
if st.session_state.logged_in:
|
|
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
import json
|
| 3 |
import hashlib
|
| 4 |
import re
|
| 5 |
from prompt_builder import build_prompt
|
| 6 |
from model_api import query_model
|
| 7 |
|
| 8 |
+
# ================= PAGE CONFIG (ONLY ONCE) =================
|
| 9 |
st.set_page_config(page_title="FitPlan Pro", layout="wide", initial_sidebar_state="collapsed")
|
| 10 |
|
| 11 |
# ================= USER DATABASE =================
|
|
|
|
| 28 |
# ================= SESSION STATE =================
|
| 29 |
if "logged_in" not in st.session_state:
|
| 30 |
st.session_state.logged_in = False
|
| 31 |
+
if "mode" not in st.session_state:
|
| 32 |
+
st.session_state.mode = "login"
|
| 33 |
|
| 34 |
+
# ================= LOGIN PAGE (UNCHANGED UI) =================
|
| 35 |
+
def apply_pro_styles():
|
|
|
|
| 36 |
st.markdown("""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
<style>
|
| 38 |
+
header, footer, [data-testid="stToolbar"] {visibility: hidden;}
|
| 39 |
+
.block-container { padding: 0 !important; margin: 0 !important; max-width: 100% !important; }
|
| 40 |
+
section.main { padding: 0 !important; }
|
| 41 |
+
.stApp { background-color: white !important; height: 100vh !important; width: 100vw; overflow-y: auto; }
|
| 42 |
+
|
| 43 |
+
.left-panel {
|
| 44 |
+
flex: 1.2;
|
| 45 |
+
background: linear-gradient(rgba(139, 0, 0, 0.75), rgba(139, 0, 0, 0.85)),
|
| 46 |
+
url("https://images.unsplash.com/photo-1534438327276-14e5300c3a48?q=80&w=2070");
|
| 47 |
+
background-size: cover;
|
| 48 |
+
background-position: center;
|
| 49 |
+
display: flex;
|
| 50 |
+
flex-direction: column;
|
| 51 |
+
justify-content: space-between;
|
| 52 |
+
padding: 5% 5%;
|
| 53 |
+
color: white;
|
| 54 |
+
height: 100vh;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
.hero-text {
|
| 58 |
+
font-size: 3.5rem;
|
| 59 |
+
font-weight: 800;
|
| 60 |
+
line-height: 1.1;
|
| 61 |
+
text-transform: uppercase;
|
| 62 |
+
margin: 30px 0;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
.stat-row { display: flex; gap: 15px; }
|
| 66 |
+
|
| 67 |
+
.stat-card {
|
| 68 |
+
background: rgba(255, 255, 255, 0.1);
|
| 69 |
+
backdrop-filter: blur(10px);
|
| 70 |
+
padding: 15px;
|
| 71 |
+
border-radius: 10px;
|
| 72 |
+
flex: 1;
|
| 73 |
+
text-align: center;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
.form-content { width: 100%; max-width: 400px; }
|
| 77 |
+
|
| 78 |
+
h1 { color: #D2042D !important; font-weight: 800 !important; font-size: 2.8rem !important; margin:0 !important;}
|
| 79 |
+
p.sub { color: #333 !important; margin-bottom: 20px; font-weight: 700; font-size: 1rem;}
|
| 80 |
+
label { color: black !important; font-weight: 700 !important; font-size: 0.85rem !important; }
|
| 81 |
+
|
| 82 |
+
div[data-baseweb="input"] {
|
| 83 |
+
border-radius: 8px !important;
|
| 84 |
+
border: 1.5px solid #eee !important;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
div[data-baseweb="input"] input {
|
| 88 |
+
background-color: #2b2d3a !important;
|
| 89 |
+
color: white !important;
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
div[data-baseweb="input"] input::placeholder {
|
| 93 |
+
color: #cccccc !important;
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
div[data-testid="stCheckbox"] label,
|
| 97 |
+
div[data-testid="stCheckbox"] label p {
|
| 98 |
+
color: black !important;
|
| 99 |
+
font-weight: 700 !important;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
div.stButton > button {
|
| 103 |
+
background: #D2042D !important;
|
| 104 |
+
color: white !important;
|
| 105 |
+
border-radius: 50px !important;
|
| 106 |
+
height: 48px !important;
|
| 107 |
+
width: 100%;
|
| 108 |
+
font-weight: 700 !important;
|
| 109 |
+
border: none !important;
|
| 110 |
+
}
|
| 111 |
</style>
|
| 112 |
+
""", unsafe_allow_html=True)
|
| 113 |
+
|
| 114 |
+
def show_auth_page():
|
| 115 |
+
apply_pro_styles()
|
| 116 |
+
l_col, r_col = st.columns([1.2, 1])
|
| 117 |
+
|
| 118 |
+
with l_col:
|
| 119 |
+
st.markdown("""
|
| 120 |
+
<div class="left-panel">
|
| 121 |
+
<div>
|
| 122 |
+
<h3>ποΈ FitPlan Pro</h3>
|
| 123 |
+
<p>PERSONALIZED FITNESS</p>
|
| 124 |
+
<div class="hero-text">Your Personalized<br>Fitness Journey<br>Starts Here.</div>
|
| 125 |
</div>
|
| 126 |
+
<div class="stat-row">
|
| 127 |
+
<div class="stat-card"><b>12K+</b><br><small>ACTIVE MEMBERS</small></div>
|
| 128 |
+
<div class="stat-card"><b>5K+</b><br><small>CUSTOM PLANS</small></div>
|
| 129 |
+
<div class="stat-card"><b>94%</b><br><small>SUCCESS RATE</small></div>
|
| 130 |
</div>
|
| 131 |
</div>
|
| 132 |
+
""", unsafe_allow_html=True)
|
| 133 |
+
|
| 134 |
+
with r_col:
|
| 135 |
+
st.markdown('<div class="form-content">', unsafe_allow_html=True)
|
| 136 |
+
|
| 137 |
+
if st.session_state.mode == "login":
|
| 138 |
+
st.markdown('<h1>WELCOME BACK!</h1>', unsafe_allow_html=True)
|
| 139 |
+
st.markdown('<p class="sub">LOGIN TO YOUR ACCOUNT.</p>', unsafe_allow_html=True)
|
| 140 |
+
|
| 141 |
+
email = st.text_input("EMAIL ADDRESS", key="l_email", placeholder="Enter your email")
|
| 142 |
+
password = st.text_input("PASSWORD", type="password", key="l_pass", placeholder="Enter your password")
|
| 143 |
+
st.checkbox("Remember me", value=True)
|
| 144 |
+
|
| 145 |
+
if st.button("LOGIN β"):
|
| 146 |
+
users = load_users()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
if email in users and users[email] == hash_password(password):
|
| 148 |
st.session_state.logged_in = True
|
|
|
|
| 149 |
st.rerun()
|
| 150 |
else:
|
| 151 |
+
st.error("Invalid Details")
|
| 152 |
+
|
| 153 |
+
st.markdown("<div style='margin-top:30px;'></div>", unsafe_allow_html=True)
|
| 154 |
+
|
| 155 |
+
st.markdown("<div style='color:black; font-weight:700; font-size:14px; margin-bottom:15px;'>Don't have an account?</div>", unsafe_allow_html=True)
|
| 156 |
+
|
| 157 |
+
if st.button("SIGN UP FREE"):
|
| 158 |
+
st.session_state.mode = "signup"
|
| 159 |
+
st.rerun()
|
| 160 |
+
|
| 161 |
+
else:
|
| 162 |
+
st.markdown('<h1>GET STARTED</h1>', unsafe_allow_html=True)
|
| 163 |
+
st.markdown('<p class="sub">CREATE YOUR NEW ACCOUNT.</p>', unsafe_allow_html=True)
|
| 164 |
+
|
| 165 |
+
new_email = st.text_input("EMAIL", key="s_email")
|
| 166 |
+
new_pass = st.text_input("PASSWORD", type="password", key="s_pass")
|
| 167 |
+
|
| 168 |
+
if st.button("REGISTER"):
|
| 169 |
+
users = load_users()
|
| 170 |
+
if new_email and new_pass:
|
| 171 |
+
users[new_email] = hash_password(new_pass)
|
| 172 |
save_users(users)
|
| 173 |
+
st.success("Account Created!")
|
| 174 |
+
st.session_state.mode = "login"
|
|
|
|
| 175 |
st.rerun()
|
| 176 |
|
| 177 |
+
if st.button("BACK TO LOGIN"):
|
| 178 |
+
st.session_state.mode = "login"
|
| 179 |
+
st.rerun()
|
| 180 |
+
|
| 181 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
| 182 |
+
|
| 183 |
+
# ================= DASHBOARD (EXACTLY YOUR ORIGINAL CODE) =================
|
| 184 |
def dashboard():
|
| 185 |
+
|
| 186 |
st.markdown("""
|
| 187 |
<style>
|
| 188 |
.stApp {
|
| 189 |
background: linear-gradient(rgba(0,0,0,0.9), rgba(0,0,0,0.9)),
|
| 190 |
url("https://images.unsplash.com/photo-1534438327276-14e5300c3a48?q=80&w=2070");
|
| 191 |
+
background-size: cover;
|
| 192 |
+
background-position: center;
|
| 193 |
+
background-attachment: fixed;
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
h1, h2, h3, label, p, span {
|
| 197 |
+
color: #FFFFFF !important;
|
| 198 |
+
font-weight: 700 !important;
|
| 199 |
+
text-transform: uppercase;
|
| 200 |
+
}
|
| 201 |
+
|
| 202 |
+
div.stButton > button:first-child {
|
| 203 |
+
width: 100% !important;
|
| 204 |
+
background-color: #000000 !important;
|
| 205 |
+
color: #FFFFFF !important;
|
| 206 |
+
font-weight: 900 !important;
|
| 207 |
+
font-size: 1.2rem !important;
|
| 208 |
+
height: 60px !important;
|
| 209 |
+
border: 2px solid #FFFFFF !important;
|
| 210 |
+
border-radius: 10px !important;
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
.stTabs [aria-selected="true"] { background-color: #FFFFFF !important; }
|
| 214 |
+
.stTabs [aria-selected="true"] p { color: #000000 !important; }
|
| 215 |
+
|
| 216 |
+
.workout-container {
|
| 217 |
+
background: rgba(255, 255, 255, 0.05);
|
| 218 |
+
padding: 20px;
|
| 219 |
+
border-radius: 10px;
|
| 220 |
+
border-left: 5px solid #FFFFFF;
|
| 221 |
+
color: #FFFFFF;
|
| 222 |
+
line-height: 1.3 !important;
|
| 223 |
+
font-size: 1rem;
|
| 224 |
}
|
|
|
|
|
|
|
|
|
|
| 225 |
</style>
|
| 226 |
""", unsafe_allow_html=True)
|
| 227 |
|
| 228 |
+
if 'workout_plan' not in st.session_state:
|
| 229 |
+
st.session_state.workout_plan = ""
|
| 230 |
+
if 'bmi_info' not in st.session_state:
|
| 231 |
+
st.session_state.bmi_info = ""
|
| 232 |
+
if 'user_name' not in st.session_state:
|
| 233 |
+
st.session_state.user_name = ""
|
| 234 |
+
|
| 235 |
+
st.title("ποΈ PERSONALIZED FITPLAN")
|
| 236 |
+
|
| 237 |
+
tab1, tab2 = st.tabs(["π ATHLETE PROFILE", "π YOUR WORKOUT PLAN"])
|
| 238 |
|
|
|
|
| 239 |
with tab1:
|
| 240 |
+
st.header("Build Your Profile")
|
| 241 |
col1, col2 = st.columns(2)
|
| 242 |
+
|
| 243 |
+
with col1:
|
| 244 |
+
name = st.text_input("NAME (Required)")
|
| 245 |
+
gender = st.selectbox("GENDER", ["Male", "Female", "Other"])
|
| 246 |
+
height_cm = st.number_input("HEIGHT (CM)", min_value=1.0)
|
| 247 |
+
|
| 248 |
+
with col2:
|
| 249 |
+
age = st.number_input("AGE (Required)", min_value=1)
|
| 250 |
+
weight_kg = st.number_input("WEIGHT (KG)", min_value=1.0)
|
| 251 |
+
goal = st.selectbox("GOAL", ["Build Muscle", "Weight Loss", "Strength", "Abs", "Flexible"])
|
| 252 |
+
|
| 253 |
+
level = st.selectbox("LEVEL", ["Beginner", "Intermediate", "Advanced"])
|
| 254 |
+
equipment = st.multiselect("EQUIPMENT", ["Dumbbells", "Barbell", "Kettlebells", "Yoga Mat", "Pull-up Bar", "No Equipment"])
|
| 255 |
+
|
| 256 |
+
if st.button("SUBMIT PROFILE"):
|
| 257 |
+
if not name or height_cm <= 1 or weight_kg <= 1:
|
| 258 |
+
st.error("π¨ PLEASE FILL IN ALL FIELDS.")
|
| 259 |
+
else:
|
| 260 |
+
with st.spinner("GENERATING..."):
|
| 261 |
+
prompt, bmi, bmi_status = build_prompt(name, gender, height_cm, weight_kg, goal, level, equipment, age)
|
| 262 |
+
raw_output = query_model(prompt)
|
| 263 |
+
|
| 264 |
+
clean_text = re.sub(r'\*', '', raw_output)
|
| 265 |
+
clean_text = re.sub(r'\n{3,}', '\n\n', clean_text)
|
| 266 |
+
clean_text = clean_text.strip()
|
| 267 |
+
|
| 268 |
+
st.session_state.workout_plan = clean_text
|
| 269 |
+
st.session_state.bmi_info = f"BMI: {bmi:.2f} | {bmi_status.upper()}"
|
| 270 |
+
st.session_state.user_name = name.upper()
|
| 271 |
+
st.success("PROFILE SUBMITTED!")
|
| 272 |
|
| 273 |
with tab2:
|
| 274 |
+
if st.session_state.workout_plan:
|
| 275 |
+
st.header(f"π₯ HELLO {st.session_state.user_name}!")
|
| 276 |
+
st.info(f"π {st.session_state.bmi_info}")
|
| 277 |
+
st.markdown("---")
|
| 278 |
st.markdown(f'<div class="workout-container">{st.session_state.workout_plan}</div>', unsafe_allow_html=True)
|
| 279 |
+
else:
|
| 280 |
+
st.warning("PLEASE SUBMIT YOUR PROFILE FIRST.")
|
| 281 |
|
| 282 |
# ================= ROUTER =================
|
| 283 |
if st.session_state.logged_in:
|