Commit
·
d3827eb
1
Parent(s):
7a5e3c8
Pytorch V0.4
Browse files
app.py
CHANGED
|
@@ -11,10 +11,35 @@ def get_data():
|
|
| 11 |
if response.status_code == 200:
|
| 12 |
data = response.json()
|
| 13 |
records = data.get("records", [])
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
else:
|
| 16 |
return [], 0
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
def display_organisations_engagees():
|
| 19 |
st.markdown("## OPEN DATA RSE")
|
| 20 |
st.markdown("### Découvrez les organisations engagées RSE de la métropole de Bordeaux")
|
|
@@ -32,18 +57,6 @@ def display_organisations_engagees():
|
|
| 32 |
df = df[["Nom", "Commune", "Section NAF", "Effectif", "Action RSE"]]
|
| 33 |
st.dataframe(df, width=None, height=None)
|
| 34 |
|
| 35 |
-
def display_map(data):
|
| 36 |
-
m = folium.Map(location=[44.837789, -0.57918], zoom_start=12)
|
| 37 |
-
for item in data:
|
| 38 |
-
lat_lon = item.get('point_geo', None)
|
| 39 |
-
if lat_lon:
|
| 40 |
-
folium.Marker(
|
| 41 |
-
[lat_lon['lat'], lat_lon['lon']],
|
| 42 |
-
icon=folium.Icon(color="green", icon="leaf"),
|
| 43 |
-
popup=item.get('Nom', 'Sans nom'),
|
| 44 |
-
).add_to(m)
|
| 45 |
-
folium_static(m)
|
| 46 |
-
|
| 47 |
def main():
|
| 48 |
st.sidebar.title("Navigation")
|
| 49 |
app_mode = st.sidebar.radio("Choisissez l'onglet", ["Organisations engagées", "Localisation des Entreprises"])
|
|
|
|
| 11 |
if response.status_code == 200:
|
| 12 |
data = response.json()
|
| 13 |
records = data.get("records", [])
|
| 14 |
+
# Ensure that 'point_geo' is extracted correctly as a dictionary with 'lat' and 'lon'
|
| 15 |
+
cleaned_data = []
|
| 16 |
+
for record in records:
|
| 17 |
+
item = record["fields"]
|
| 18 |
+
point_geo = item.get("point_geo", {})
|
| 19 |
+
if isinstance(point_geo, dict):
|
| 20 |
+
lat = point_geo.get("lat")
|
| 21 |
+
lon = point_geo.get("lon")
|
| 22 |
+
if lat and lon:
|
| 23 |
+
item['latitude'] = lat
|
| 24 |
+
item['longitude'] = lon
|
| 25 |
+
cleaned_data.append(item)
|
| 26 |
+
return cleaned_data, data.get("nhits", 0)
|
| 27 |
else:
|
| 28 |
return [], 0
|
| 29 |
|
| 30 |
+
def display_map(data):
|
| 31 |
+
m = folium.Map(location=[44.837789, -0.57918], zoom_start=12)
|
| 32 |
+
for item in data:
|
| 33 |
+
lat = item.get('latitude')
|
| 34 |
+
lon = item.get('longitude')
|
| 35 |
+
if lat and lon:
|
| 36 |
+
folium.Marker(
|
| 37 |
+
[lat, lon],
|
| 38 |
+
icon=folium.Icon(color="green", icon="leaf"),
|
| 39 |
+
popup=item.get('Nom', 'Sans nom'),
|
| 40 |
+
).add_to(m)
|
| 41 |
+
folium_static(m)
|
| 42 |
+
|
| 43 |
def display_organisations_engagees():
|
| 44 |
st.markdown("## OPEN DATA RSE")
|
| 45 |
st.markdown("### Découvrez les organisations engagées RSE de la métropole de Bordeaux")
|
|
|
|
| 57 |
df = df[["Nom", "Commune", "Section NAF", "Effectif", "Action RSE"]]
|
| 58 |
st.dataframe(df, width=None, height=None)
|
| 59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
def main():
|
| 61 |
st.sidebar.title("Navigation")
|
| 62 |
app_mode = st.sidebar.radio("Choisissez l'onglet", ["Organisations engagées", "Localisation des Entreprises"])
|