Commit
·
f3a6502
1
Parent(s):
48d778d
V2
Browse files
app.py
CHANGED
|
@@ -33,38 +33,33 @@ def display_organisations_engagees():
|
|
| 33 |
df = df[["Nom", "Commune", "Section NAF", "Effectif", "Action RSE"]]
|
| 34 |
st.dataframe(df, width=None, height=None)
|
| 35 |
|
| 36 |
-
# Fonction pour afficher la carte
|
| 37 |
-
def display_map(
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
st.error(f"La latitude est vide pour l'item: {item}")
|
| 48 |
-
else: # Si 'point_geo' ou 'lat' est absent
|
| 49 |
-
st.error(f"Données géographiques incomplètes ou absentes pour l'item: {item}")
|
| 50 |
-
except ValueError as e:
|
| 51 |
-
# Si la conversion en float échoue
|
| 52 |
-
st.error(f"Erreur lors de la conversion de la latitude pour l'item: {item}. Erreur: {e}")
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
def main():
|
| 55 |
-
|
| 56 |
-
st.
|
| 57 |
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
]
|
| 65 |
-
|
| 66 |
-
# Appel de la fonction pour afficher les données
|
| 67 |
-
display_map(items)
|
| 68 |
|
| 69 |
if __name__ == "__main__":
|
| 70 |
main()
|
|
|
|
| 33 |
df = df[["Nom", "Commune", "Section NAF", "Effectif", "Action RSE"]]
|
| 34 |
st.dataframe(df, width=None, height=None)
|
| 35 |
|
| 36 |
+
# Fonction pour afficher la carte
|
| 37 |
+
def display_map():
|
| 38 |
+
data, _ = get_data()
|
| 39 |
+
if data:
|
| 40 |
+
m = folium.Map(location=[44.84474, -0.60711], zoom_start=12)
|
| 41 |
+
for item in data:
|
| 42 |
+
if 'point_geo' in item and item['point_geo']:
|
| 43 |
+
lat = float(item['point_geo']['lat'])
|
| 44 |
+
lon = float(item['point_geo']['lon'])
|
| 45 |
+
folium.Marker([lat, lon], popup=item.get("nom_courant_denomination", "Sans nom")).add_to(m)
|
| 46 |
+
folium_static(m)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
+
# Fonction pour l'onglet "Dialoguer avec l'assistant IA RSE bziiit"
|
| 49 |
+
def display_dialogue():
|
| 50 |
+
st.markdown("# Patientez quelques heures encore... :)")
|
| 51 |
+
|
| 52 |
+
# Main function orchestrating the app UI
|
| 53 |
def main():
|
| 54 |
+
st.sidebar.title("Navigation")
|
| 55 |
+
app_mode = st.sidebar.radio("Choisissez l'onglet", ["Organisations engagées", "Carte", "Dialoguer avec l'assistant IA RSE bziiit"])
|
| 56 |
|
| 57 |
+
if app_mode == "Organisations engagées":
|
| 58 |
+
display_organisations_engagees()
|
| 59 |
+
elif app_mode == "Carte":
|
| 60 |
+
display_map()
|
| 61 |
+
elif app_mode == "Dialoguer avec l'assistant IA RSE bziiit":
|
| 62 |
+
display_dialogue()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
if __name__ == "__main__":
|
| 65 |
main()
|