Spaces:
Sleeping
Sleeping
Download src/api/app.py from leskimou/projet_MLops_part2: direct link, hf CLI and curl.
- Browser
- Download file 773 Bytes
-
https://huggingface.co/spaces/leskimou/projet_MLops_part2/resolve/main/src/api/app.py
- Command line
-
hf download hf://spaces/leskimou/projet_MLops_part2/src/api/app.py
-
curl -L -o app.py https://huggingface.co/spaces/leskimou/projet_MLops_part2/resolve/main/src/api/app.py
773 Bytes
| import streamlit as st | |
| if "user" not in st.session_state: | |
| st.session_state.user = None | |
| user = st.session_state.user | |
| if user is None: | |
| pg = st.navigation([st.Page("authentification.py", title="Connexion")]) | |
| else: | |
| role_labels = { | |
| "administrateur": "Administrateur", | |
| } | |
| role_label = role_labels.get(user["role"], "Client") | |
| st.sidebar.success(f"Connecté : **{user['username']}**") | |
| st.sidebar.caption(f"Rôle : {role_label}") | |
| if st.sidebar.button("Se déconnecter"): | |
| st.session_state.user = None | |
| st.rerun() | |
| pages = [st.Page("prediction.py", title="Prédiction")] | |
| if user["role"] == "administrateur": | |
| pages.append(st.Page("monitoring.py", title="Monitoring")) | |
| pg = st.navigation(pages) | |
| pg.run() | |