Rimjhim Mittal commited on
Commit ·
126530f
1
Parent(s): d40dc23
reset session states on uploading new model
Browse files
app.py
CHANGED
|
@@ -12,6 +12,12 @@ st.set_page_config(layout="wide", page_icon="logo.png", page_title="Model Descri
|
|
| 12 |
|
| 13 |
# models: Purpose: To store the state of the model and update the model
|
| 14 |
import numpy as np
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
def run_simulation(param_inputs, mdf_model):
|
| 17 |
mod_graph = mdf_model.graphs[0]
|
|
@@ -370,7 +376,10 @@ def main():
|
|
| 370 |
st.title("Welcome to Model Description Format")
|
| 371 |
st.write("Lets get started! Choose one of the following methods.")
|
| 372 |
mdf_model = upload_file_and_load_to_model() # controller
|
|
|
|
| 373 |
if mdf_model:
|
|
|
|
|
|
|
| 374 |
mod_graph = mdf_model.graphs[0]
|
| 375 |
nodes = mod_graph.nodes
|
| 376 |
parameters = []
|
|
|
|
| 12 |
|
| 13 |
# models: Purpose: To store the state of the model and update the model
|
| 14 |
import numpy as np
|
| 15 |
+
def reset_simulation_state():
|
| 16 |
+
"""Reset simulation-related session state variables."""
|
| 17 |
+
if 'simulation_results' in st.session_state:
|
| 18 |
+
del st.session_state.simulation_results
|
| 19 |
+
if 'selected_columns' in st.session_state:
|
| 20 |
+
del st.session_state.selected_columns
|
| 21 |
|
| 22 |
def run_simulation(param_inputs, mdf_model):
|
| 23 |
mod_graph = mdf_model.graphs[0]
|
|
|
|
| 376 |
st.title("Welcome to Model Description Format")
|
| 377 |
st.write("Lets get started! Choose one of the following methods.")
|
| 378 |
mdf_model = upload_file_and_load_to_model() # controller
|
| 379 |
+
|
| 380 |
if mdf_model:
|
| 381 |
+
reset_simulation_state()
|
| 382 |
+
|
| 383 |
mod_graph = mdf_model.graphs[0]
|
| 384 |
nodes = mod_graph.nodes
|
| 385 |
parameters = []
|