Spaces:
Running
Running
LaurentTRIPIED
commited on
Commit
•
2c9e460
1
Parent(s):
e7aad60
Pytorch V0.9
Browse files
app.py
CHANGED
@@ -9,8 +9,17 @@ def get_data():
|
|
9 |
response = requests.get(url)
|
10 |
if response.status_code == 200:
|
11 |
data = response.json()
|
12 |
-
records = data
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
else:
|
15 |
return []
|
16 |
|
@@ -19,25 +28,23 @@ def display_organisations_engagees(data):
|
|
19 |
st.markdown("### Découvrez les organisations engagées RSE de la métropole de Bordeaux")
|
20 |
|
21 |
df = pd.DataFrame(data)
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
}))
|
31 |
|
32 |
def display_map(data):
|
33 |
-
|
34 |
-
m = folium.Map(location=bordeaux_loc, zoom_start=12)
|
35 |
for item in data:
|
36 |
-
if item
|
37 |
folium.Marker(
|
38 |
-
|
39 |
-
popup=item.get("nom_courant_denomination", "Information non disponible"),
|
40 |
icon=folium.Icon(color="green", icon="leaf"),
|
|
|
41 |
).add_to(m)
|
42 |
folium_static(m)
|
43 |
|
|
|
9 |
response = requests.get(url)
|
10 |
if response.status_code == 200:
|
11 |
data = response.json()
|
12 |
+
records = data["records"]
|
13 |
+
data_for_display = []
|
14 |
+
for record in records:
|
15 |
+
field = record["fields"]
|
16 |
+
# Assume that 'geolocalisation' field is present and correctly formatted
|
17 |
+
if "geolocalisation" in field:
|
18 |
+
lat, lon = field["geolocalisation"]
|
19 |
+
field["latitude"] = lat
|
20 |
+
field["longitude"] = lon
|
21 |
+
data_for_display.append(field)
|
22 |
+
return data_for_display
|
23 |
else:
|
24 |
return []
|
25 |
|
|
|
28 |
st.markdown("### Découvrez les organisations engagées RSE de la métropole de Bordeaux")
|
29 |
|
30 |
df = pd.DataFrame(data)
|
31 |
+
df = df[['nom_courant_denomination', 'commune', 'libelle_section_naf', 'tranche_effectif_entreprise', 'action_rse']]
|
32 |
+
st.dataframe(df.rename(columns={
|
33 |
+
'nom_courant_denomination': 'Nom',
|
34 |
+
'commune': 'Commune',
|
35 |
+
'libelle_section_naf': 'Section NAF',
|
36 |
+
'tranche_effectif_entreprise': 'Effectif',
|
37 |
+
'action_rse': 'Action RSE'
|
38 |
+
}))
|
|
|
39 |
|
40 |
def display_map(data):
|
41 |
+
m = folium.Map(location=[44.837789, -0.57918], zoom_start=12)
|
|
|
42 |
for item in data:
|
43 |
+
if 'latitude' in item and 'longitude' in item:
|
44 |
folium.Marker(
|
45 |
+
[item['latitude'], item['longitude']],
|
|
|
46 |
icon=folium.Icon(color="green", icon="leaf"),
|
47 |
+
popup=item['nom_courant_denomination'],
|
48 |
).add_to(m)
|
49 |
folium_static(m)
|
50 |
|