Fabrice-TIERCELIN commited on
Commit
1d54d76
·
verified ·
1 Parent(s): 7a3f32b

Display or not the debug items

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -133,6 +133,12 @@ def predict(source_img, enlarge_top, enlarge_right, enlarge_bottom, enlarge_left
133
  mask_image
134
  ]
135
 
 
 
 
 
 
 
136
  with gr.Blocks() as interface:
137
  gr.Markdown(
138
  """
@@ -195,13 +201,14 @@ with gr.Blocks() as interface:
195
  with gr.Row():
196
  information = gr.Label(label = "Information")
197
  with gr.Row():
198
- original_image = gr.Image(label = "Original image")
199
  with gr.Row():
200
- enlarged_image = gr.Image(label = "Enlarged image")
201
  with gr.Row():
202
- mask_image = gr.Image(label = "Mask image")
203
 
204
- submit.click(predict, inputs = [
 
205
  source_img,
206
  enlarge_top,
207
  enlarge_right,
 
133
  mask_image
134
  ]
135
 
136
+ def toggle_debug(is_debug_mode):
137
+ if is_debug_mode:
138
+ return [gr.update(visible = True)] * 3
139
+ else:
140
+ return [gr.update(visible = False)] * 3
141
+
142
  with gr.Blocks() as interface:
143
  gr.Markdown(
144
  """
 
201
  with gr.Row():
202
  information = gr.Label(label = "Information")
203
  with gr.Row():
204
+ original_image = gr.Image(label = "Original image", visible = False)
205
  with gr.Row():
206
+ enlarged_image = gr.Image(label = "Enlarged image", visible = False)
207
  with gr.Row():
208
+ mask_image = gr.Image(label = "Mask image", visible = False)
209
 
210
+ submit.click(toggle_debug, debug_mode, [original_image, enlarged_image, mask_image], queue = False,
211
+ show_progress = False).then(predict, inputs = [
212
  source_img,
213
  enlarge_top,
214
  enlarge_right,