Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import base64 | |
| import accueil | |
| import population | |
| import adolescente | |
| import rapport | |
| # Fonction pour convertir une image en base64 | |
| def image_to_base64(image_path): | |
| with open(image_path, "rb") as img_file: | |
| return base64.b64encode(img_file.read()).decode("utf-8") | |
| # Utiliser un chemin relatif pour l'image | |
| image_path = "logo RSD.jpg" # Assurez-vous que le fichier image est bien à cet emplacement | |
| image_base64 = image_to_base64(image_path) | |
| # Affichage de l'image en base64 dans la barre latérale avec CSS pour le centrer | |
| st.markdown( | |
| f""" | |
| <style> | |
| .sidebar .sidebar-content {{ | |
| display: flex; | |
| flex-direction: column; | |
| align-items: center; | |
| }} | |
| .sidebar img {{ | |
| width: 120px; | |
| margin-bottom: 15px; | |
| }} | |
| </style> | |
| <div class="sidebar"> | |
| <img src="data:image/png;base64,{image_base64}" alt="Logo"> | |
| </div> | |
| """, | |
| unsafe_allow_html=True | |
| ) | |
| # Exemple de navigation de votre application | |
| st.sidebar.title("Navigation") | |
| page = st.sidebar.selectbox("Choisissez une page", ["Accueil", "Dashboard", "Prédiction", "Reporting"]) | |
| # Afficher la page sélectionnée | |
| if page == "Accueil": | |
| accueil.show() | |
| elif page == "Dashboard": | |
| population.show() | |
| elif page == "Prédiction": | |
| adolescente.show() | |
| elif page == "Reporting": | |
| rapport.show() | |