From f51c8e0962fc7f56993502b83ee8ddb42ed82e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Pedersen?= Date: Fri, 21 Jun 2024 13:30:48 +0200 Subject: [PATCH 1/2] Improve error handling in download button --- demo/src/gui.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/demo/src/gui.py b/demo/src/gui.py index 2686eaf..6953110 100644 --- a/demo/src/gui.py +++ b/demo/src/gui.py @@ -33,6 +33,9 @@ def __init__( self.cwd = cwd self.share = share + self.filename = None + self.extension = None + self.class_name = "airways" # default self.class_names = { "airways": "CT_Airways", @@ -102,10 +105,11 @@ def process(self, mesh_file_name): return "./prediction.obj" def download_prediction(self): - if (not self.filename) or (not self.extension): + if ( self.filename is None) or (not self.extension is None): LOGGER.error( "The prediction is not available or ready to download. Wait until the result is available in the 3D viewer." ) + raise ValueError("Run inference before downloading!") return self.filename + "." + self.extension def get_img_pred_pair(self, k): From ee7e25560a4990d35670a65e38823ffdbe106155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Pedersen?= Date: Fri, 21 Jun 2024 13:43:34 +0200 Subject: [PATCH 2/2] Handle edge case better --- demo/src/gui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/src/gui.py b/demo/src/gui.py index 6953110..a89c87f 100644 --- a/demo/src/gui.py +++ b/demo/src/gui.py @@ -105,7 +105,7 @@ def process(self, mesh_file_name): return "./prediction.obj" def download_prediction(self): - if ( self.filename is None) or (not self.extension is None): + if (self.filename is None) or (self.extension is None): LOGGER.error( "The prediction is not available or ready to download. Wait until the result is available in the 3D viewer." )