end ponit
Browse files
app.py
CHANGED
@@ -9,22 +9,22 @@ if st.query_params.get("page", "") == "docs":
|
|
9 |
st.rerun()
|
10 |
|
11 |
# Set the FastAPI base URL
|
12 |
-
API_URL = "https://tharu22-world-population.hf.space
|
13 |
|
14 |
# Streamlit app title
|
15 |
st.title("World Population Dashboard")
|
16 |
|
17 |
# Sidebar filter for continents
|
18 |
st.sidebar.header("Filter")
|
19 |
-
|
20 |
"Select the Continent:",
|
21 |
['Asia', 'Africa', 'North America', 'South America', 'Europe', 'Oceania']
|
22 |
)
|
23 |
|
24 |
# Fetch data from the FastAPI endpoint
|
25 |
-
if st.sidebar.button("
|
26 |
# Call FastAPI to get continent data
|
27 |
-
response = requests.get(f"{API_URL}/continent/{
|
28 |
|
29 |
if response.status_code == 200:
|
30 |
data = response.json()
|
|
|
9 |
st.rerun()
|
10 |
|
11 |
# Set the FastAPI base URL
|
12 |
+
API_URL = "https://tharu22-world-population.hf.space"
|
13 |
|
14 |
# Streamlit app title
|
15 |
st.title("World Population Dashboard")
|
16 |
|
17 |
# Sidebar filter for continents
|
18 |
st.sidebar.header("Filter")
|
19 |
+
selected_continent = st.sidebar.selectbox(
|
20 |
"Select the Continent:",
|
21 |
['Asia', 'Africa', 'North America', 'South America', 'Europe', 'Oceania']
|
22 |
)
|
23 |
|
24 |
# Fetch data from the FastAPI endpoint
|
25 |
+
if st.sidebar.button("/continent/{continent_name"):
|
26 |
# Call FastAPI to get continent data
|
27 |
+
response = requests.get(f"{API_URL}/continent/{selected_continent}")
|
28 |
|
29 |
if response.status_code == 200:
|
30 |
data = response.json()
|