Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
import streamlit as st
|
2 |
from requests_toolkit import AirQualityQuery
|
3 |
|
|
|
4 |
st.markdown('''# Country Air Quality Ranking''')
|
5 |
country = st.text_input(
|
6 |
label=' ',
|
7 |
placeholder=' Which country do you want to query?',
|
|
|
8 |
)
|
9 |
|
10 |
if country is not None and country != '':
|
@@ -12,11 +14,18 @@ if country is not None and country != '':
|
|
12 |
| -------- | -------- | -------- | -------- |
|
13 |
'''
|
14 |
md= st.empty()
|
15 |
-
generator =
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
|
|
|
1 |
import streamlit as st
|
2 |
from requests_toolkit import AirQualityQuery
|
3 |
|
4 |
+
|
5 |
st.markdown('''# Country Air Quality Ranking''')
|
6 |
country = st.text_input(
|
7 |
label=' ',
|
8 |
placeholder=' Which country do you want to query?',
|
9 |
+
# label_visibility = 'collapsed'
|
10 |
)
|
11 |
|
12 |
if country is not None and country != '':
|
|
|
14 |
| -------- | -------- | -------- | -------- |
|
15 |
'''
|
16 |
md= st.empty()
|
17 |
+
generator = AirQualityQuery.air_quality_by_country(country, return_frequency=10)
|
18 |
+
while True:
|
19 |
+
try:
|
20 |
+
with st.spinner():
|
21 |
+
i = next(generator)
|
22 |
+
new_md = ''
|
23 |
+
for id, j in enumerate(i):
|
24 |
+
new_md += f'''|{id + 1}|{j[0]}|{j[1]}|{j[2]}|\n'''
|
25 |
+
md.markdown(md_head + new_md)
|
26 |
+
except StopIteration:
|
27 |
+
break
|
28 |
+
|
29 |
+
|
30 |
|
31 |
|