Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,6 +12,7 @@ import os
|
|
| 12 |
import seaborn as sns
|
| 13 |
import time
|
| 14 |
import random
|
|
|
|
| 15 |
|
| 16 |
# Configuring the web page and setting the page title and icon
|
| 17 |
st.set_page_config(
|
|
@@ -72,14 +73,14 @@ with tab1:
|
|
| 72 |
df_building_new = new_building_fg.read(read_options={"use_hive": True})
|
| 73 |
return df_building_new
|
| 74 |
|
|
|
|
|
|
|
|
|
|
| 75 |
col1, col2 = st.columns(2)
|
| 76 |
|
| 77 |
with col1:
|
| 78 |
st.subheader("Magnetic field prediction")
|
| 79 |
|
| 80 |
-
# Retrieving building data
|
| 81 |
-
building_new = retrieve_building()
|
| 82 |
-
|
| 83 |
# Making the predictions and getting the latest data for magnetic field data
|
| 84 |
building_mag_prediction_data = building_new[['time', 'x', 'y', 'z', 'temperature', 'et0_fao_evapotranspiration']]
|
| 85 |
building_mag_prediction_data['et0_fao_evapotranspiration'] = building_mag_prediction_data['et0_fao_evapotranspiration'].apply(fill_nan_with_zero)
|
|
@@ -111,6 +112,11 @@ with tab1:
|
|
| 111 |
st.cache_data.clear()
|
| 112 |
# Immediately rerun the application
|
| 113 |
st.experimental_rerun()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
with tab2:
|
| 116 |
|
|
|
|
| 12 |
import seaborn as sns
|
| 13 |
import time
|
| 14 |
import random
|
| 15 |
+
from sklearn.preprocessing import StandardScaler
|
| 16 |
|
| 17 |
# Configuring the web page and setting the page title and icon
|
| 18 |
st.set_page_config(
|
|
|
|
| 73 |
df_building_new = new_building_fg.read(read_options={"use_hive": True})
|
| 74 |
return df_building_new
|
| 75 |
|
| 76 |
+
# Retrieving building data
|
| 77 |
+
building_new = retrieve_building()
|
| 78 |
+
|
| 79 |
col1, col2 = st.columns(2)
|
| 80 |
|
| 81 |
with col1:
|
| 82 |
st.subheader("Magnetic field prediction")
|
| 83 |
|
|
|
|
|
|
|
|
|
|
| 84 |
# Making the predictions and getting the latest data for magnetic field data
|
| 85 |
building_mag_prediction_data = building_new[['time', 'x', 'y', 'z', 'temperature', 'et0_fao_evapotranspiration']]
|
| 86 |
building_mag_prediction_data['et0_fao_evapotranspiration'] = building_mag_prediction_data['et0_fao_evapotranspiration'].apply(fill_nan_with_zero)
|
|
|
|
| 112 |
st.cache_data.clear()
|
| 113 |
# Immediately rerun the application
|
| 114 |
st.experimental_rerun()
|
| 115 |
+
|
| 116 |
+
now = datetime.now() # Get current time
|
| 117 |
+
today = now
|
| 118 |
+
yesterday = today - timedelta(days=1)
|
| 119 |
+
|
| 120 |
|
| 121 |
with tab2:
|
| 122 |
|