Download Home.py from sterdil/wercore: direct link, hf CLI and curl.
- Browser
- Download file 3.82 kB
-
https://huggingface.co/spaces/sterdil/wercore/resolve/main/Home.py
- Command line
-
hf download hf://spaces/sterdil/wercore/Home.py
-
curl -L -o Home.py https://huggingface.co/spaces/sterdil/wercore/resolve/main/Home.py
3.82 kB
| import streamlit as st | |
| import os | |
| # ββ 1. CONFIG & ASSETS ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| st.set_page_config(page_title="Wercore | App Generator", page_icon="π’", layout="wide") | |
| st.markdown(""" | |
| <style> | |
| [data-testid="stLogo"] { height: 6rem !important; object-fit: contain !important; } | |
| /* Make the page links look like large menu cards */ | |
| div[data-testid="stPageLink-NavLink"] { | |
| background-color: #f8f9fa; | |
| border: 1px solid #e0e0e0; | |
| border-radius: 8px; | |
| padding: 15px !important; | |
| text-align: center; | |
| transition: all 0.3s ease; | |
| } | |
| div[data-testid="stPageLink-NavLink"]:hover { | |
| background-color: #0054a6; | |
| color: white !important; | |
| border-color: #0054a6; | |
| transform: translateY(-2px); | |
| box-shadow: 0 4px 6px rgba(0,0,0,0.1); | |
| } | |
| div[data-testid="stPageLink-NavLink"] p { | |
| font-size: 1.1rem; | |
| font-weight: 600; | |
| } | |
| </style> | |
| """, unsafe_allow_html=True) | |
| st.logo("WERCORE logo.png") | |
| # ββ 2. LOGIN SYSTEM βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| if not st.session_state.get("authenticated", False): | |
| # CRITICAL FIX: Hide the sidebar and its toggle button entirely until logged in | |
| st.markdown(""" | |
| <style> | |
| [data-testid="stSidebar"] { display: none !important; } | |
| [data-testid="collapsedControl"] { display: none !important; } | |
| </style> | |
| """, unsafe_allow_html=True) | |
| col1, col2, col3 = st.columns([1, 2, 1]) | |
| with col2: | |
| st.title("π Wercore Portal") | |
| st.info("Please log in to access the reporting engines.") | |
| password = st.text_input("Master Password", type="password") | |
| if st.button("Secure Login", type="primary", use_container_width=True): | |
| if password == "Wercore2026": | |
| st.session_state["authenticated"] = True | |
| st.rerun() | |
| else: | |
| st.error("β Incorrect Password.") | |
| st.stop() | |
| # ββ 3. HEADER βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| st.title("Wercore App Generator") | |
| st.markdown("Select a reporting engine below to begin generating compliance documentation.") | |
| st.markdown("---") | |
| # ββ 4. NAVIGATION GRID (CRASH-PROOF) ββββββββββββββββββββββββββββββββββββββββββ | |
| # This function stops the app from crashing if a file name is misspelled | |
| def safe_link(file_path, label, icon): | |
| if os.path.exists(file_path): | |
| st.page_link(file_path, label=label, icon=icon) | |
| else: | |
| st.warning(f"β οΈ **Missing File:** Please ensure `{file_path}` exists.") | |
| col1, col2 = st.columns(2) | |
| with col1: | |
| safe_link("pages/1_Water_Tank_Report.py", "Water Tank Disinfection", "π§") | |
| st.write("") # Spacer | |
| safe_link("pages/4_Pipeline_Disinfection.py", "Pipeline Disinfection", "π°") | |
| with col2: | |
| safe_link("pages/2_Pest_Control_Report.py", "Pest Control Report", "πͺ³") | |
| st.write("") # Spacer | |
| # Updated to the correct exact filename you provided | |
| safe_link("pages/3_Termite_Control_Report.py", "Termite Control Report", "π") | |
| st.markdown("---") | |
| st.caption("Β© 2026 Sterdil Labs") |