tharu22 commited on
Commit
d7c9cba
·
1 Parent(s): 84d07b1
Files changed (1) hide show
  1. app.py +4 -4
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/Asia"
13
 
14
  # Streamlit app title
15
  st.title("World Population Dashboard")
16
 
17
  # Sidebar filter for continents
18
  st.sidebar.header("Filter")
19
- continent_name = 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("Get Data"):
26
  # Call FastAPI to get continent data
27
- response = requests.get(f"{API_URL}/continent/{continent_name}")
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()