Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +15 -0
src/streamlit_app.py
CHANGED
|
@@ -26,6 +26,21 @@ def load_data():
|
|
| 26 |
|
| 27 |
df = load_data()
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
# Plot 1
|
| 30 |
variable_labels = {
|
| 31 |
'temperature_2m': 'Temperature (°C)',
|
|
|
|
| 26 |
|
| 27 |
df = load_data()
|
| 28 |
|
| 29 |
+
# Buttons at the top
|
| 30 |
+
col1, col2 = st.columns([1, 1])
|
| 31 |
+
refresh_data = col1.button("🔄 Refresh Weather Data")
|
| 32 |
+
refresh_plots = col2.button("🔃 Refresh Plots")
|
| 33 |
+
|
| 34 |
+
if refresh_data:
|
| 35 |
+
st.cache_data.clear()
|
| 36 |
+
st.success("✅ Weather data refreshed from API!")
|
| 37 |
+
|
| 38 |
+
if refresh_plots:
|
| 39 |
+
st.toast("🔁 Visualizations reloaded")
|
| 40 |
+
|
| 41 |
+
# Always (re)load data
|
| 42 |
+
df = load_data()
|
| 43 |
+
|
| 44 |
# Plot 1
|
| 45 |
variable_labels = {
|
| 46 |
'temperature_2m': 'Temperature (°C)',
|