Spaces:
Sleeping
Sleeping
Commit
·
0571917
1
Parent(s):
36ff46c
added output reset after page change
Browse files
pages/1_Short_Term_Consumption.py
CHANGED
|
@@ -7,6 +7,16 @@ from utils import load_and_process_data, create_time_series_plot, display_statis
|
|
| 7 |
if 'api_token' not in st.session_state:
|
| 8 |
st.session_state.api_token = "p2s8X9qL4zF7vN3mK6tR1bY5cA0wE3hJ"
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# Initialize session state variables
|
| 11 |
if 'current_file' not in st.session_state:
|
| 12 |
st.session_state.current_file = None
|
|
|
|
| 7 |
if 'api_token' not in st.session_state:
|
| 8 |
st.session_state.api_token = "p2s8X9qL4zF7vN3mK6tR1bY5cA0wE3hJ"
|
| 9 |
|
| 10 |
+
page_id = 1
|
| 11 |
+
if 'current_page' not in st.session_state:
|
| 12 |
+
st.session_state.current_page = page_id
|
| 13 |
+
elif st.session_state.current_page != page_id:
|
| 14 |
+
# Clear API response when switching to this page
|
| 15 |
+
if 'api_response' in st.session_state:
|
| 16 |
+
st.session_state.api_response = None
|
| 17 |
+
# Update current page
|
| 18 |
+
st.session_state.current_page = page_id
|
| 19 |
+
|
| 20 |
# Initialize session state variables
|
| 21 |
if 'current_file' not in st.session_state:
|
| 22 |
st.session_state.current_file = None
|
pages/2_Long_Term_Consumption.py
CHANGED
|
@@ -6,6 +6,16 @@ from utils import load_and_process_data, create_time_series_plot, display_statis
|
|
| 6 |
if 'api_token' not in st.session_state:
|
| 7 |
st.session_state.api_token = "p2s8X9qL4zF7vN3mK6tR1bY5cA0wE3hJ"
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
# Initialize session state variables
|
| 10 |
if 'current_file' not in st.session_state:
|
| 11 |
st.session_state.current_file = None
|
|
|
|
| 6 |
if 'api_token' not in st.session_state:
|
| 7 |
st.session_state.api_token = "p2s8X9qL4zF7vN3mK6tR1bY5cA0wE3hJ"
|
| 8 |
|
| 9 |
+
page_id = 2
|
| 10 |
+
if 'current_page' not in st.session_state:
|
| 11 |
+
st.session_state.current_page = page_id
|
| 12 |
+
elif st.session_state.current_page != page_id:
|
| 13 |
+
# Clear API response when switching to this page
|
| 14 |
+
if 'api_response' in st.session_state:
|
| 15 |
+
st.session_state.api_response = None
|
| 16 |
+
# Update current page
|
| 17 |
+
st.session_state.current_page = page_id
|
| 18 |
+
|
| 19 |
# Initialize session state variables
|
| 20 |
if 'current_file' not in st.session_state:
|
| 21 |
st.session_state.current_file = None
|
pages/3_Short_Term_Production.py
CHANGED
|
@@ -6,6 +6,16 @@ from utils import load_and_process_data, create_time_series_plot, display_statis
|
|
| 6 |
if 'api_token' not in st.session_state:
|
| 7 |
st.session_state.api_token = "p2s8X9qL4zF7vN3mK6tR1bY5cA0wE3hJ"
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
# Initialize session state variables
|
| 10 |
if 'current_file' not in st.session_state:
|
| 11 |
st.session_state.current_file = None
|
|
|
|
| 6 |
if 'api_token' not in st.session_state:
|
| 7 |
st.session_state.api_token = "p2s8X9qL4zF7vN3mK6tR1bY5cA0wE3hJ"
|
| 8 |
|
| 9 |
+
page_id = 3
|
| 10 |
+
if 'current_page' not in st.session_state:
|
| 11 |
+
st.session_state.current_page = page_id
|
| 12 |
+
elif st.session_state.current_page != page_id:
|
| 13 |
+
# Clear API response when switching to this page
|
| 14 |
+
if 'api_response' in st.session_state:
|
| 15 |
+
st.session_state.api_response = None
|
| 16 |
+
# Update current page
|
| 17 |
+
st.session_state.current_page = page_id
|
| 18 |
+
|
| 19 |
# Initialize session state variables
|
| 20 |
if 'current_file' not in st.session_state:
|
| 21 |
st.session_state.current_file = None
|
pages/4_NILM_Analysis.py
CHANGED
|
@@ -6,6 +6,16 @@ from utils import load_and_process_data, create_time_series_plot, display_statis
|
|
| 6 |
if 'api_token' not in st.session_state:
|
| 7 |
st.session_state.api_token = "p2s8X9qL4zF7vN3mK6tR1bY5cA0wE3hJ"
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
# Initialize session state variables
|
| 10 |
if 'current_file' not in st.session_state:
|
| 11 |
st.session_state.current_file = None
|
|
|
|
| 6 |
if 'api_token' not in st.session_state:
|
| 7 |
st.session_state.api_token = "p2s8X9qL4zF7vN3mK6tR1bY5cA0wE3hJ"
|
| 8 |
|
| 9 |
+
page_id = 4
|
| 10 |
+
if 'current_page' not in st.session_state:
|
| 11 |
+
st.session_state.current_page = page_id
|
| 12 |
+
elif st.session_state.current_page != page_id:
|
| 13 |
+
# Clear API response when switching to this page
|
| 14 |
+
if 'api_response' in st.session_state:
|
| 15 |
+
st.session_state.api_response = None
|
| 16 |
+
# Update current page
|
| 17 |
+
st.session_state.current_page = page_id
|
| 18 |
+
|
| 19 |
# Initialize session state variables
|
| 20 |
if 'current_file' not in st.session_state:
|
| 21 |
st.session_state.current_file = None
|
pages/5_Anomaly_Detection_Consumption.py
CHANGED
|
@@ -10,6 +10,16 @@ import plotly.graph_objects as go
|
|
| 10 |
if 'api_token' not in st.session_state:
|
| 11 |
st.session_state.api_token = "p2s8X9qL4zF7vN3mK6tR1bY5cA0wE3hJ"
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# Initialize session state variables
|
| 14 |
if 'current_file' not in st.session_state:
|
| 15 |
st.session_state.current_file = None
|
|
@@ -109,10 +119,6 @@ if st.session_state.json_data:
|
|
| 109 |
st.session_state.api_token,
|
| 110 |
"inference_consumption_ad"
|
| 111 |
)
|
| 112 |
-
with col2:
|
| 113 |
-
if st.button("Clear Results", key="clear_button"):
|
| 114 |
-
st.session_state.api_response = None
|
| 115 |
-
st.experimental_rerun()
|
| 116 |
except Exception as e:
|
| 117 |
st.error(f"Error processing data: {str(e)}")
|
| 118 |
|
|
|
|
| 10 |
if 'api_token' not in st.session_state:
|
| 11 |
st.session_state.api_token = "p2s8X9qL4zF7vN3mK6tR1bY5cA0wE3hJ"
|
| 12 |
|
| 13 |
+
page_id = 5
|
| 14 |
+
if 'current_page' not in st.session_state:
|
| 15 |
+
st.session_state.current_page = page_id
|
| 16 |
+
elif st.session_state.current_page != page_id:
|
| 17 |
+
# Clear API response when switching to this page
|
| 18 |
+
if 'api_response' in st.session_state:
|
| 19 |
+
st.session_state.api_response = None
|
| 20 |
+
# Update current page
|
| 21 |
+
st.session_state.current_page = page_id
|
| 22 |
+
|
| 23 |
# Initialize session state variables
|
| 24 |
if 'current_file' not in st.session_state:
|
| 25 |
st.session_state.current_file = None
|
|
|
|
| 119 |
st.session_state.api_token,
|
| 120 |
"inference_consumption_ad"
|
| 121 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
except Exception as e:
|
| 123 |
st.error(f"Error processing data: {str(e)}")
|
| 124 |
|
pages/6_Anomaly_Detection_Production.py
CHANGED
|
@@ -10,6 +10,16 @@ import plotly.graph_objects as go
|
|
| 10 |
if 'api_token' not in st.session_state:
|
| 11 |
st.session_state.api_token = "p2s8X9qL4zF7vN3mK6tR1bY5cA0wE3hJ"
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# Initialize session state variables
|
| 14 |
if 'current_file' not in st.session_state:
|
| 15 |
st.session_state.current_file = None
|
|
@@ -109,10 +119,7 @@ if st.session_state.json_data:
|
|
| 109 |
st.session_state.api_token,
|
| 110 |
"inference_production_ad"
|
| 111 |
)
|
| 112 |
-
|
| 113 |
-
if st.button("Clear Results", key="clear_button"):
|
| 114 |
-
st.session_state.api_response = None
|
| 115 |
-
st.experimental_rerun()
|
| 116 |
except Exception as e:
|
| 117 |
st.error(f"Error processing data: {str(e)}")
|
| 118 |
|
|
|
|
| 10 |
if 'api_token' not in st.session_state:
|
| 11 |
st.session_state.api_token = "p2s8X9qL4zF7vN3mK6tR1bY5cA0wE3hJ"
|
| 12 |
|
| 13 |
+
page_id = 6
|
| 14 |
+
if 'current_page' not in st.session_state:
|
| 15 |
+
st.session_state.current_page = page_id
|
| 16 |
+
elif st.session_state.current_page != page_id:
|
| 17 |
+
# Clear API response when switching to this page
|
| 18 |
+
if 'api_response' in st.session_state:
|
| 19 |
+
st.session_state.api_response = None
|
| 20 |
+
# Update current page
|
| 21 |
+
st.session_state.current_page = page_id
|
| 22 |
+
|
| 23 |
# Initialize session state variables
|
| 24 |
if 'current_file' not in st.session_state:
|
| 25 |
st.session_state.current_file = None
|
|
|
|
| 119 |
st.session_state.api_token,
|
| 120 |
"inference_production_ad"
|
| 121 |
)
|
| 122 |
+
|
|
|
|
|
|
|
|
|
|
| 123 |
except Exception as e:
|
| 124 |
st.error(f"Error processing data: {str(e)}")
|
| 125 |
|