Skip to content

Commit

Permalink
Add logging warnings for model connection and project application errors
Browse files Browse the repository at this point in the history
  • Loading branch information
GoldenAnpu committed Dec 21, 2024
1 parent 60893fb commit d5567da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,7 @@ def get_and_update_predictions_preview():
"Please connect to both models before getting predictions preview.",
status="warning",
)
sly.logger.warning("Please connect to both models before getting predictions preview.")
return
new_random_images_preview_button.disable()
if g.force_common_tab or inference_prompt_types.get_active_tab() == common_tab_name:
Expand Down Expand Up @@ -755,7 +756,13 @@ def get_inference_settings():
output_project_info = apply_to_project_event(
destination_project, get_inference_settings(), F_MODEL_DATA, S_MODEL_DATA
)

if output_project_info is None:
sly.logger.warning(
"Something went wrong during applying models to project."
"Project thumbnail will not be shown. "
"Check logs for more information."
)
return
output_project_thmb.set(output_project_info)
output_project_thmb.show()
sly.logger.info("Project was successfully labeled")
Expand Down
1 change: 1 addition & 0 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def apply_to_project_event(
f"Please run both models before applying them to the project",
status="warning",
)
sly.logger.warning("Please run both models before applying them to the project")
return

def update_proj_meta_classes(
Expand Down

0 comments on commit d5567da

Please sign in to comment.