Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,17 @@ import pytz
|
|
7 |
# Set the timezone to Indian Standard Time (IST)
|
8 |
indian_timezone = pytz.timezone('Asia/Kolkata')
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
def get_aqi_data():
|
11 |
url = 'https://www.aqi.in/dashboard/india/jammu-and-kashmir/srinagar'
|
12 |
r = requests.get(url)
|
@@ -47,23 +58,30 @@ def main():
|
|
47 |
|
48 |
aqi, level, temp, pm25, pm10 = get_aqi_data()
|
49 |
|
50 |
-
|
51 |
-
st.
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
st.write(f"**
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
st.
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
st.markdown('### Developer:')
|
68 |
st.text('Adil Aziz')
|
69 |
st.text('Data Scientist')
|
|
|
7 |
# Set the timezone to Indian Standard Time (IST)
|
8 |
indian_timezone = pytz.timezone('Asia/Kolkata')
|
9 |
|
10 |
+
# Custom CSS for styling
|
11 |
+
custom_css = """
|
12 |
+
<style>
|
13 |
+
body {
|
14 |
+
color: orange;
|
15 |
+
background-color: black;
|
16 |
+
}
|
17 |
+
</style>
|
18 |
+
"""
|
19 |
+
st.markdown(custom_css, unsafe_allow_html=True)
|
20 |
+
|
21 |
def get_aqi_data():
|
22 |
url = 'https://www.aqi.in/dashboard/india/jammu-and-kashmir/srinagar'
|
23 |
r = requests.get(url)
|
|
|
58 |
|
59 |
aqi, level, temp, pm25, pm10 = get_aqi_data()
|
60 |
|
61 |
+
# Set up columns for horizontal layout
|
62 |
+
col1, col2 = st.columns([2, 1])
|
63 |
+
|
64 |
+
# Current Data section
|
65 |
+
with col1:
|
66 |
+
st.markdown('### Current Data:')
|
67 |
+
st.write(f"- **AQI:** {aqi} ({level})")
|
68 |
+
st.write(f"- **PM2.5:** {pm25} µg/m³")
|
69 |
+
st.write(f"- **PM10:** {pm10} µg/m³")
|
70 |
+
st.write(f"- **Temperature:** {temp}˚C")
|
71 |
+
|
72 |
+
# Display Data in Buttons section
|
73 |
+
with col2:
|
74 |
+
st.markdown('### Display Data in Buttons:')
|
75 |
+
if st.button('Show AQI'):
|
76 |
+
st.write(f"**AQI:** {aqi} ({level})")
|
77 |
+
if st.button('Show PM2.5'):
|
78 |
+
st.write(f"**PM2.5:** {pm25} µg/m³")
|
79 |
+
if st.button('Show PM10'):
|
80 |
+
st.write(f"**PM10:** {pm10} µg/m³")
|
81 |
+
if st.button('Show Temperature'):
|
82 |
+
st.write(f"**Temperature:** {temp}˚C")
|
83 |
+
|
84 |
+
# Developer section
|
85 |
st.markdown('### Developer:')
|
86 |
st.text('Adil Aziz')
|
87 |
st.text('Data Scientist')
|