Skip to content

Commit

Permalink
Merge branch 'master' of github.com:DSD-DBS/capella-model-explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
vik378 committed Jan 29, 2024
2 parents 44af3f2 + 2e07f27 commit cd4b52d
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions capella_model_explorer/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,21 @@ def describe_object(obj):
)

if not model_name:
st.session_state["model_name"] = None
st.session_state["model"] = None
st.stop()

if (
"model_name" not in st.session_state
or st.session_state["model_name"] != model_name
):
if st.session_state.get("model_name") != model_name:
all_models = st.session_state["all_models"]
st.session_state.clear()
st.session_state["all_models"] = all_models
st.session_state["model"] = capellambse.MelodyModel(
st.session_state["all_models"][model_name]
)
st.session_state["model_name"] = model_name

with st.sidebar, st.spinner(f"Loading {model_name}..."):
st.session_state["model"] = capellambse.MelodyModel(
st.session_state["all_models"][model_name]
)
st.session_state["model_name"] = model_name

model = st.session_state["model"]
with st.sidebar:
st.write(f"Loaded model {model.name!r}")
Expand Down

0 comments on commit cd4b52d

Please sign in to comment.