Spaces:
Runtime error
Runtime error
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +74 -12
src/streamlit_app.py
CHANGED
|
@@ -1,16 +1,78 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
"
|
| 7 |
-
|
| 8 |
-
"Flexibility",
|
| 9 |
-
"Weight Loss",
|
| 10 |
-
"Build Muscle",
|
| 11 |
-
"Strength Gaining",
|
| 12 |
-
"Abs Building"
|
| 13 |
-
]
|
| 14 |
)
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
|
| 4 |
+
# ------------------ PAGE CONFIG ------------------
|
| 5 |
+
st.set_page_config(
|
| 6 |
+
page_title="Streamlit Frontend Demo",
|
| 7 |
+
layout="wide",
|
| 8 |
+
page_icon="📊"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
)
|
| 10 |
|
| 11 |
+
# ------------------ TITLE ------------------
|
| 12 |
+
st.title("📊 Streamlit Frontend Demo App")
|
| 13 |
+
st.caption("Only Frontend | Hugging Face Space")
|
| 14 |
+
|
| 15 |
+
# ------------------ SIDEBAR ------------------
|
| 16 |
+
st.sidebar.title("🔹 Menu")
|
| 17 |
+
page = st.sidebar.selectbox("Navigation", ["Home", "Form", "Charts", "About"])
|
| 18 |
+
|
| 19 |
+
# ------------------ HOME PAGE ------------------
|
| 20 |
+
if page == "Home":
|
| 21 |
+
st.header("Welcome")
|
| 22 |
+
st.text("This is a simple Streamlit frontend project.")
|
| 23 |
+
st.markdown("**Streamlit** makes Python web apps easy.")
|
| 24 |
+
|
| 25 |
+
col1, col2 = st.columns(2)
|
| 26 |
+
|
| 27 |
+
with col1:
|
| 28 |
+
st.success("Frontend Ready")
|
| 29 |
+
|
| 30 |
+
with col2:
|
| 31 |
+
st.info("Running on Hugging Face")
|
| 32 |
+
|
| 33 |
+
# ------------------ FORM PAGE ------------------
|
| 34 |
+
elif page == "Form":
|
| 35 |
+
st.header("User Input Form")
|
| 36 |
+
|
| 37 |
+
with st.form("user_form"):
|
| 38 |
+
name = st.text_input("Enter your name")
|
| 39 |
+
age = st.number_input("Enter your age", 1, 100)
|
| 40 |
+
course = st.selectbox("Select course", ["Python", "AI", "Data Science"])
|
| 41 |
+
agree = st.checkbox("I agree to terms")
|
| 42 |
+
|
| 43 |
+
submit = st.form_submit_button("Submit")
|
| 44 |
+
|
| 45 |
+
if submit:
|
| 46 |
+
if agree:
|
| 47 |
+
st.success("Form submitted successfully!")
|
| 48 |
+
st.write("Name:", name)
|
| 49 |
+
st.write("Age:", age)
|
| 50 |
+
st.write("Course:", course)
|
| 51 |
+
else:
|
| 52 |
+
st.warning("Please accept terms")
|
| 53 |
+
|
| 54 |
+
# ------------------ CHARTS PAGE ------------------
|
| 55 |
+
elif page == "Charts":
|
| 56 |
+
st.header("Charts & Data")
|
| 57 |
+
|
| 58 |
+
data = {
|
| 59 |
+
"Marks": [70, 80, 90, 85]
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
df = pd.DataFrame(data)
|
| 63 |
+
|
| 64 |
+
st.subheader("Table")
|
| 65 |
+
st.dataframe(df)
|
| 66 |
+
|
| 67 |
+
st.subheader("Bar Chart")
|
| 68 |
+
st.bar_chart(df)
|
| 69 |
+
|
| 70 |
+
# ------------------ ABOUT PAGE ------------------
|
| 71 |
+
elif page == "About":
|
| 72 |
+
st.header("About App")
|
| 73 |
+
st.write("This is a frontend-only Streamlit app.")
|
| 74 |
+
st.write("No backend. No AI model.")
|
| 75 |
+
st.write("Deployed on Hugging Face Spaces.")
|
| 76 |
+
|
| 77 |
+
# ------------------ FOOTER ------------------
|
| 78 |
+
st.caption("Made with ❤️ using Streamlit")
|