File size: 1,035 Bytes
d0661bd
fc09623
 
 
 
c4b812c
d63f1d2
9ee810a
fc09623
d63f1d2
 
fc09623
 
 
 
 
 
 
c5b60b4
fc09623
0527fa6
fc09623
 
 
 
 
 
 
6eadae5
0527fa6
10118ca
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import streamlit as st
import pandas as pd
import requests
import folium
from streamlit_folium import folium_static
from organisations_engagees import display_organisations_engagees
from localisation import display_map

# Fonction pour récupérer les données de l'API
def get_data():
    url = "https://opendata.bordeaux-metropole.fr/api/records/1.0/search/?dataset=met_etablissement_rse&q=&rows=100"
    response = requests.get(url)
    if response.status_code == 200:
        data = response.json()
        records = data.get("records", [])
        return [record["fields"] for record in records], data.get("nhits", 0)
    else:
        return [], 0

# Main function orchestrating the app UI
def main():
    st.sidebar.title("Navigation")
    app_mode = st.sidebar.radio("Choisissez l'onglet", ["Organisations engagées", "Localisations"])

    if app_mode == "Organisations engagées":
        display_organisations_engagees()
    elif app_mode == "Localisations":
        display_map()
    
if __name__ == "__main__":
    main()