Download src/app.py from HarizalD/SPACE: direct link, hf CLI and curl.
- Browser
- Download file 1.47 kB
-
https://huggingface.co/spaces/HarizalD/SPACE/resolve/main/src/app.py
- Command line
-
hf download hf://spaces/HarizalD/SPACE/src/app.py
-
curl -L -o app.py https://huggingface.co/spaces/HarizalD/SPACE/resolve/main/src/app.py
1.47 kB
| import pandas as pd | |
| import streamlit as st | |
| def login(): | |
| st.title("π Login Sistem") | |
| username = st.text_input("Username") | |
| password = st.text_input("Password", type="password") | |
| if st.button("Login"): | |
| if username == "admin" and password == "1234": | |
| st.session_state["login"] = True | |
| st.success("Login berhasil β ") | |
| else: | |
| st.error("Username atau Password salah!") | |
| def dashboard(): | |
| st.title("π Dashboard Space Management - Sports & Health") | |
| if "data" not in st.session_state: | |
| st.session_state["data"] = pd.DataFrame({ | |
| "ID": [1, 2, 3], | |
| "Nama File": ["Laporan_A.xlsx", "Proposal_B.docx", "Data_C.csv"], | |
| "Status": ["Menunggu", "Menunggu", "Menunggu"] | |
| }) | |
| st.subheader("π Master Data") | |
| st.dataframe(st.session_state["data"]) | |
| pilihan = st.selectbox("Pilih File untuk Approve/Tolak", | |
| st.session_state["data"]["Nama File"]) | |
| aksi = st.radio("Aksi", ["Setujui", "Tolak"]) | |
| if st.button("Update Status"): | |
| idx = st.session_state["data"].index[ | |
| st.session_state["data"]["Nama File"] == pilihan | |
| ][0] | |
| st.session_state["data"].at[idx, "Status"] = aksi | |
| st.success(f"File '{pilihan}' berhasil diupdate menjadi {aksi}") | |
| if "login" not in st.session_state: | |
| st.session_state["login"] = False | |
| if st.session_state["login"]: | |
| dashboard() | |
| else: | |
| login() | |