Spaces:
Build error
Build error
| import streamlit as st | |
| import pandas as pd | |
| st.set_page_config(page_title="Green Valley School", layout="wide") | |
| # Sidebar navigation | |
| menu = st.sidebar.radio("Navigate", [ | |
| "Home", "About Us", "Admissions", "Academics", "Faculty", | |
| "Student Portal", "Admin", "Events", "Contact Us" | |
| ]) | |
| # Home Page | |
| if menu == "Home": | |
| st.title("Welcome to Green Valley School") | |
| st.image("https://via.placeholder.com/800x300.png?text=Green+Valley+School", use_column_width=True) | |
| st.markdown(""" | |
| **Empowering the Future Generation.** | |
| A place where knowledge meets passion, and students grow into leaders. | |
| """) | |
| # About Us | |
| elif menu == "About Us": | |
| st.header("About Green Valley School") | |
| st.write(""" | |
| Established in 1998, Green Valley School has been a beacon of excellence in education. | |
| Our mission is to nurture and inspire young minds to achieve academic and personal success. | |
| """) | |
| # Admissions | |
| elif menu == "Admissions": | |
| st.header("Admission Inquiry Form") | |
| with st.form("admission_form"): | |
| name = st.text_input("Full Name") | |
| grade = st.selectbox("Applying for Grade", list(range(1, 13))) | |
| email = st.text_input("Email Address") | |
| message = st.text_area("Why do you want to join?") | |
| submitted = st.form_submit_button("Submit") | |
| if submitted: | |
| # Save to CSV or DB | |
| df = pd.DataFrame([[name, grade, email, message]], columns=["Name", "Grade", "Email", "Message"]) | |
| df.to_csv("admissions.csv", mode='a', index=False, header=False) | |
| st.success("Your inquiry has been submitted!") | |
| # Academics | |
| elif menu == "Academics": | |
| st.header("Academic Programs") | |
| st.write(""" | |
| - **Primary School (Grades 1–5)** | |
| - **Middle School (Grades 6–8)** | |
| - **High School (Grades 9–12)** | |
| - Specialized programs in STEM, Arts, Sports and more. | |
| """) | |
| # Faculty | |
| elif menu == "Faculty": | |
| st.header("Our Faculty") | |
| st.write("Meet our dedicated teachers and staff.") | |
| faculty_data = pd.DataFrame({ | |
| "Name": ["Mr. Ali", "Ms. Sana", "Dr. Khalid"], | |
| "Subject": ["Mathematics", "Science", "English"], | |
| "Experience (Years)": [10, 7, 12] | |
| }) | |
| st.table(faculty_data) | |
| # Student Portal | |
| elif menu == "Student Portal": | |
| st.header("Student Login") | |
| st.warning("This is a demo login.") | |
| username = st.text_input("Username") | |
| password = st.text_input("Password", type="password") | |
| if st.button("Login"): | |
| if username == "student" and password == "123": | |
| st.success("Login successful!") | |
| st.info("View your grades, timetable, and more (under development).") | |
| else: | |
| st.error("Invalid credentials.") | |
| # Admin | |
| elif menu == "Admin": | |
| st.header("Admin Portal") | |
| admin_pass = st.text_input("Enter Admin Password", type="password") | |
| if admin_pass == "admin123": | |
| st.success("Access granted!") | |
| st.subheader("Submitted Admission Forms") | |
| try: | |
| data = pd.read_csv("admissions.csv", header=None, names=["Name", "Grade", "Email", "Message"]) | |
| st.dataframe(data) | |
| except: | |
| st.warning("No admission data yet.") | |
| else: | |
| st.info("Enter password to access.") | |
| # Events | |
| elif menu == "Events": | |
| st.header("Upcoming Events") | |
| st.markdown(""" | |
| - **Science Fair** – 15th April | |
| - **Annual Sports Day** – 25th May | |
| - **PTM** – 5th June | |
| """) | |
| # Contact Us | |
| elif menu == "Contact Us": | |
| st.header("Get in Touch") | |
| st.write("Email: info@greenvalleyschool.edu.pk") | |
| st.write("Phone: +92-300-0000000") | |
| st.write("Address: Street 123, Swabi, KPK") |