Spaces:
Sleeping
Sleeping
changed code
Browse files
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.
|
| 8 |
st.error("Page not found. Redirecting to the main dashboard...")
|
| 9 |
-
st.
|
| 10 |
-
st.
|
| 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']}")
|