andreped commited on
Commit
f51c8e0
1 Parent(s): 35de495

Improve error handling in download button

Browse files
Files changed (1) hide show
  1. demo/src/gui.py +5 -1
demo/src/gui.py CHANGED
@@ -33,6 +33,9 @@ class WebUI:
33
  self.cwd = cwd
34
  self.share = share
35
 
 
 
 
36
  self.class_name = "airways" # default
37
  self.class_names = {
38
  "airways": "CT_Airways",
@@ -102,10 +105,11 @@ class WebUI:
102
  return "./prediction.obj"
103
 
104
  def download_prediction(self):
105
- if (not self.filename) or (not self.extension):
106
  LOGGER.error(
107
  "The prediction is not available or ready to download. Wait until the result is available in the 3D viewer."
108
  )
 
109
  return self.filename + "." + self.extension
110
 
111
  def get_img_pred_pair(self, k):
 
33
  self.cwd = cwd
34
  self.share = share
35
 
36
+ self.filename = None
37
+ self.extension = None
38
+
39
  self.class_name = "airways" # default
40
  self.class_names = {
41
  "airways": "CT_Airways",
 
105
  return "./prediction.obj"
106
 
107
  def download_prediction(self):
108
+ if ( self.filename is None) or (not self.extension is None):
109
  LOGGER.error(
110
  "The prediction is not available or ready to download. Wait until the result is available in the 3D viewer."
111
  )
112
+ raise ValueError("Run inference before downloading!")
113
  return self.filename + "." + self.extension
114
 
115
  def get_img_pred_pair(self, k):