tharu22 commited on
Commit
ddc1a61
Β·
1 Parent(s): a87b658
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -21,14 +21,14 @@ if st.sidebar.button("Get Data"):
21
 
22
  if response.status_code == 200:
23
  try:
24
- data = response.json() # Attempt to parse JSON
25
 
26
  st.header(f"πŸ“Š {selected_continent} - Population Statistics")
27
 
28
  # Display data in Streamlit
29
  st.write(f"🟒 **Max Population:** {data.get('Max', 'N/A')}")
30
  st.write(f"πŸ”΄ **Min Population:** {data.get('Min', 'N/A')}")
31
- st.write(f"πŸ“‰ **Average Population:** {data.get('Average', 'N/A')}")
32
  st.write(f"🌎 **Total Area:** {data.get('Area', 'N/A')}")
33
  st.write(f"πŸ‘₯ **Total Population:** {data.get('Sum', 'N/A')}")
34
  st.write(f"πŸ— **Population Density:** {data.get('density', 'N/A')}")
@@ -40,5 +40,4 @@ if st.sidebar.button("Get Data"):
40
  st.error(f"API Error {response.status_code}: {response.text}")
41
 
42
  except requests.exceptions.RequestException as e:
43
- st.error(f"Request failed: {e}")
44
-
 
21
 
22
  if response.status_code == 200:
23
  try:
24
+ data = response.json()
25
 
26
  st.header(f"πŸ“Š {selected_continent} - Population Statistics")
27
 
28
  # Display data in Streamlit
29
  st.write(f"🟒 **Max Population:** {data.get('Max', 'N/A')}")
30
  st.write(f"πŸ”΄ **Min Population:** {data.get('Min', 'N/A')}")
31
+ st.write(f"πŸ“‰ **Average Population:** {data.get('Avgerage', 'N/A')}")
32
  st.write(f"🌎 **Total Area:** {data.get('Area', 'N/A')}")
33
  st.write(f"πŸ‘₯ **Total Population:** {data.get('Sum', 'N/A')}")
34
  st.write(f"πŸ— **Population Density:** {data.get('density', 'N/A')}")
 
40
  st.error(f"API Error {response.status_code}: {response.text}")
41
 
42
  except requests.exceptions.RequestException as e:
43
+ st.error(f"Request failed: {e}")