Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import base64
|
| 3 |
+
import accueil
|
| 4 |
+
import population
|
| 5 |
+
import adolescente
|
| 6 |
+
import rapport
|
| 7 |
+
|
| 8 |
+
# Fonction pour convertir une image en base64
|
| 9 |
+
def image_to_base64(image_path):
|
| 10 |
+
with open(image_path, "rb") as img_file:
|
| 11 |
+
return base64.b64encode(img_file.read()).decode("utf-8")
|
| 12 |
+
|
| 13 |
+
# Utiliser un chemin relatif pour l'image
|
| 14 |
+
image_path = "logo RSD.jpg" # Assurez-vous que le fichier image est bien à cet emplacement
|
| 15 |
+
image_base64 = image_to_base64(image_path)
|
| 16 |
+
|
| 17 |
+
# Affichage de l'image en base64 dans la barre latérale avec CSS pour le centrer
|
| 18 |
+
st.markdown(
|
| 19 |
+
f"""
|
| 20 |
+
<style>
|
| 21 |
+
.sidebar .sidebar-content {{
|
| 22 |
+
display: flex;
|
| 23 |
+
flex-direction: column;
|
| 24 |
+
align-items: center;
|
| 25 |
+
}}
|
| 26 |
+
.sidebar img {{
|
| 27 |
+
width: 120px;
|
| 28 |
+
margin-bottom: 15px;
|
| 29 |
+
}}
|
| 30 |
+
</style>
|
| 31 |
+
<div class="sidebar">
|
| 32 |
+
<img src="data:image/png;base64,{image_base64}" alt="Logo">
|
| 33 |
+
</div>
|
| 34 |
+
""",
|
| 35 |
+
unsafe_allow_html=True
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
# Exemple de navigation de votre application
|
| 39 |
+
st.sidebar.title("Navigation")
|
| 40 |
+
page = st.sidebar.selectbox("Choisissez une page", ["Accueil", "Dashboard", "Prédiction", "Reporting"])
|
| 41 |
+
|
| 42 |
+
# Afficher la page sélectionnée
|
| 43 |
+
if page == "Accueil":
|
| 44 |
+
accueil.show()
|
| 45 |
+
elif page == "Dashboard":
|
| 46 |
+
population.show()
|
| 47 |
+
elif page == "Prédiction":
|
| 48 |
+
adolescente.show()
|
| 49 |
+
elif page == "Reporting":
|
| 50 |
+
rapport.show()
|