Spaces:
Runtime error
Runtime error
Commit
·
0fff078
1
Parent(s):
5ae01c7
V3.0
Browse files
app.py
CHANGED
|
@@ -33,42 +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 |
-
#
|
| 37 |
-
def
|
| 38 |
data, _ = get_data()
|
| 39 |
if data:
|
| 40 |
m = folium.Map(location=[44.84474, -0.60711], zoom_start=11)
|
| 41 |
for item in data:
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
except (ValueError, TypeError, IndexError):
|
| 53 |
-
# Gestion des erreurs pour la conversion en float, format de données inattendu, ou index manquant
|
| 54 |
-
continue
|
| 55 |
folium_static(m)
|
| 56 |
|
| 57 |
-
# Fonction pour l'onglet "Dialoguer avec l'assistant IA RSE bziiit"
|
| 58 |
-
def display_dialogue():
|
| 59 |
-
st.markdown("# Patientez quelques heures encore... :)")
|
| 60 |
-
|
| 61 |
# Main function orchestrating the app UI
|
| 62 |
def main():
|
| 63 |
st.sidebar.title("Navigation")
|
| 64 |
-
app_mode = st.sidebar.radio("Choisissez l'onglet", ["Organisations engagées", "
|
| 65 |
|
| 66 |
if app_mode == "Organisations engagées":
|
| 67 |
display_organisations_engagees()
|
| 68 |
-
elif app_mode == "
|
| 69 |
-
|
| 70 |
-
elif app_mode == "Dialoguer avec l'assistant IA RSE bziiit":
|
| 71 |
-
display_dialogue()
|
| 72 |
|
| 73 |
if __name__ == "__main__":
|
| 74 |
main()
|
|
|
|
| 33 |
df = df[["Nom", "Commune", "Section NAF", "Effectif", "Action RSE"]]
|
| 34 |
st.dataframe(df, width=None, height=None)
|
| 35 |
|
| 36 |
+
# Nouvelle fonction pour l'onglet "GeoRSE Insights"
|
| 37 |
+
def display_geo_rse_insights():
|
| 38 |
data, _ = get_data()
|
| 39 |
if data:
|
| 40 |
m = folium.Map(location=[44.84474, -0.60711], zoom_start=11)
|
| 41 |
for item in data:
|
| 42 |
+
point_geo = item.get('point_geo', [])
|
| 43 |
+
if point_geo:
|
| 44 |
+
lat, lon = point_geo
|
| 45 |
+
lat, lon = float(lat), float(lon)
|
| 46 |
+
if lat and lon:
|
| 47 |
+
folium.Marker(
|
| 48 |
+
[lat, lon],
|
| 49 |
+
popup=f"<b>{item.get('nom_courant_denomination', 'Sans nom')}</b><br>Action RSE: {item.get('action_rse', 'Non spécifié')}",
|
| 50 |
+
icon=folium.Icon(color="green", icon="leaf"),
|
| 51 |
+
).add_to(m)
|
|
|
|
|
|
|
|
|
|
| 52 |
folium_static(m)
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
# Main function orchestrating the app UI
|
| 55 |
def main():
|
| 56 |
st.sidebar.title("Navigation")
|
| 57 |
+
app_mode = st.sidebar.radio("Choisissez l'onglet", ["Organisations engagées", "GeoRSE Insights"])
|
| 58 |
|
| 59 |
if app_mode == "Organisations engagées":
|
| 60 |
display_organisations_engagees()
|
| 61 |
+
elif app_mode == "GeoRSE Insights":
|
| 62 |
+
display_geo_rse_insights()
|
|
|
|
|
|
|
| 63 |
|
| 64 |
if __name__ == "__main__":
|
| 65 |
main()
|