Skip to content

Commit

Permalink
Bugs fixing (#97)
Browse files Browse the repository at this point in the history
* fix link to lightning pose

* fix eks no model_dir

* fix eks link
  • Loading branch information
Shmuel-columbia authored Jul 15, 2024
1 parent d27cb2a commit d6037b8
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 31 deletions.
4 changes: 2 additions & 2 deletions lightning_pose_app/ui/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,12 +562,12 @@ def _render_streamlit_fn(state: AppState):
)
st.markdown(
"[Lightning Pose]"
"(https://lightning-pose.readthedocs.io/en/latest/.html#)",
"(https://lightning-pose.readthedocs.io/en/latest/)",
unsafe_allow_html=True,
)
st.markdown(
"[Ensemble Kalman Smoother (EKS)]"
"(https://pose-app.readthedocs.io/en/latest/source/tabs/train_infer.html#tab-train-infer-ensemble#)", # noqa
"(https://pose-app.readthedocs.io/en/latest/source/tabs/train_infer.html#tab-train-infer-ensemble)", # noqa
unsafe_allow_html=True,
)
st.divider()
Expand Down
67 changes: 38 additions & 29 deletions lightning_pose_app/ui/train_infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1181,35 +1181,44 @@ def _render_streamlit_fn(state: AppState):
eks_tab = st.container()
with eks_tab:
st.header("Create an ensemble of models")
# Create a model list with no pre exist eks models in it
model_dir = os.path.join(state.proj_dir[1:], MODELS_DIR)
trained_models_no_eks = find_models(
model_dir,
must_contain_predictions=False,
must_contain_config=True
)
selected_models = st.multiselect(
"Select models for ensembling",
sorted(trained_models_no_eks, reverse=True),
help="Select which models you want to create an new ensemble model",
)
eks_model_name = st.text_input(
label="Add ensemble name",
value="eks",
help="Provide a name that will be appended to the data/time information."
)
eks_model_name = eks_model_name.replace(" ", "_")

st_submit_button_eks = st.button(
"Create ensemble",
key="eks_unique_key_button",
disabled=(
len(selected_models) < 2
or state.run_script_train
or state.run_script_infer
),
)

try:
# Create a model list with no pre exist eks models in it
model_dir = os.path.join(state.proj_dir[1:], MODELS_DIR)
if not os.path.exists(model_dir):
st.info("No model directory found. Please train models first to proceed with\
creating an ensemble model."
)
st_submit_button_eks = None
else:
trained_models_no_eks = find_models(
model_dir,
must_contain_predictions=False,
must_contain_config=True
)
selected_models = st.multiselect(
"Select models for ensembling",
sorted(trained_models_no_eks, reverse=True),
help="Select which models you want to create an new ensemble model",
)
eks_model_name = st.text_input(
label="Add ensemble name",
value="eks",
help="Provide a name that will be appended to the data/time information."
)
eks_model_name = eks_model_name.replace(" ", "_")

st_submit_button_eks = st.button(
"Create ensemble",
key="eks_unique_key_button",
disabled=(
len(selected_models) < 2
or state.run_script_train
or state.run_script_infer
),
)
except Exception as e:
st.error(f"An error occurred: {e}")

if st_submit_button_eks:

model_abs_paths = [
Expand Down

0 comments on commit d6037b8

Please sign in to comment.