Spaces:
Sleeping

tharu22 commited on
Commit
596a70e
·
1 Parent(s): 5b4ac00

changed code

Browse files
Files changed (1) hide show
  1. app.py +4 -10
app.py CHANGED
@@ -2,12 +2,11 @@ import streamlit as st
2
  import requests
3
  import pandas as pd
4
 
5
-
6
  # Redirect /docs to the main page
7
- if st.experimental_get_query_params().get("page", [""])[0] == "docs":
8
  st.error("Page not found. Redirecting to the main dashboard...")
9
- st.experimental_set_query_params(page="")
10
- st.experimental_rerun()
11
 
12
  # Set the FastAPI base URL
13
  API_URL = "https://tharu22-world-population.hf.space"
@@ -46,11 +45,6 @@ if st.sidebar.button("Get Data"):
46
  f"Min Population:{data['min_population']['country']} "
47
  f"({data['min_population']['population']:,})"
48
  )
49
-
50
- # countries_data=data['countries']
51
- # country_df = pd.DataFrame(countries_data)
52
- # st.subheader(f"Population of Countries in {data['continent']}")
53
- # st.bar_chart(country_df.set_index("Country"))z
54
  else:
55
  # Handle errors
56
- st.error(f"Error: {response.json()['detail']}")
 
2
  import requests
3
  import pandas as pd
4
 
 
5
  # Redirect /docs to the main page
6
+ if st.query_params.get("page", "") == "docs":
7
  st.error("Page not found. Redirecting to the main dashboard...")
8
+ st.query_params["page"] = ""
9
+ st.rerun()
10
 
11
  # Set the FastAPI base URL
12
  API_URL = "https://tharu22-world-population.hf.space"
 
45
  f"Min Population:{data['min_population']['country']} "
46
  f"({data['min_population']['population']:,})"
47
  )
 
 
 
 
 
48
  else:
49
  # Handle errors
50
+ st.error(f"Error: {response.json()['detail']}")