@@ -28,8 +28,7 @@ def main_ui_panel(is_depth_tab):
28
28
with gr .Group ():
29
29
with gr .Row ():
30
30
inp += 'boost' , gr .Checkbox (label = "BOOST (multi-resolution merging)" , value = True )
31
- with gr .Group (visible = False ) as options_depend_on_boost :
32
- inp += 'match_size' , gr .Checkbox (label = "Match net size to input size" , value = False )
31
+ inp += 'match_size' , gr .Checkbox (label = "Match net size to input size" , value = False )
33
32
with gr .Row (visible = False ) as options_depend_on_match_size :
34
33
inp += 'net_width' , gr .Slider (minimum = 64 , maximum = 2048 , step = 64 , label = 'Net width' , value = 448 )
35
34
inp += 'net_height' , gr .Slider (minimum = 64 , maximum = 2048 , step = 64 , label = 'Net height' , value = 448 )
@@ -62,10 +61,9 @@ def main_ui_panel(is_depth_tab):
62
61
inp += "gen_stereo" , gr .Checkbox (label = "Generate stereoscopic image(s)" , value = False )
63
62
with gr .Group (visible = False ) as stereo_options :
64
63
with gr .Row ():
65
- with gr .Row ():
66
- inp += "stereo_modes" , gr .CheckboxGroup (
67
- ["left-right" , "right-left" , "top-bottom" , "bottom-top" , "red-cyan-anaglyph" ],
68
- label = "Output" , value = ["left-right" , "red-cyan-anaglyph" ])
64
+ inp += "stereo_modes" , gr .CheckboxGroup (
65
+ ["left-right" , "right-left" , "top-bottom" , "bottom-top" , "red-cyan-anaglyph" ],
66
+ label = "Output" , value = ["left-right" , "red-cyan-anaglyph" ])
69
67
with gr .Row ():
70
68
inp += "stereo_divergence" , gr .Slider (minimum = 0.05 , maximum = 10.005 , step = 0.01 ,
71
69
label = 'Divergence (3D effect)' ,
@@ -137,10 +135,10 @@ def update_delault_net_size(model_type):
137
135
)
138
136
139
137
inp ['boost' ].change (
140
- fn = lambda a , b : (options_depend_on_boost .update (visible = not a ),
138
+ fn = lambda a , b : (inp [ 'match_size' ] .update (visible = not a ),
141
139
options_depend_on_match_size .update (visible = not a and not b )),
142
140
inputs = [inp ['boost' ], inp ['match_size' ]],
143
- outputs = [options_depend_on_boost , options_depend_on_match_size ]
141
+ outputs = [inp [ 'match_size' ] , options_depend_on_match_size ]
144
142
)
145
143
inp ['match_size' ].change (
146
144
fn = lambda a , b : options_depend_on_match_size .update (visible = not a and not b ),
@@ -176,11 +174,8 @@ def update_delault_net_size(model_type):
176
174
outputs = [inp ['clipthreshold_far' ]]
177
175
)
178
176
179
- def stereo_options_visibility (v ):
180
- return stereo_options .update (visible = v )
181
-
182
177
inp ['gen_stereo' ].change (
183
- fn = stereo_options_visibility ,
178
+ fn = lambda v : stereo_options . update ( visible = v ) ,
184
179
inputs = [inp ['gen_stereo' ]],
185
180
outputs = [stereo_options ]
186
181
)
@@ -191,22 +186,15 @@ def stereo_options_visibility(v):
191
186
outputs = [mesh_options ]
192
187
)
193
188
194
- def inpaint_options_visibility (v ):
195
- return inpaint_options_row_0 .update (visible = v )
196
-
197
189
if is_depth_tab :
198
190
inp ['inpaint' ].change (
199
- fn = inpaint_options_visibility ,
191
+ fn = lambda v : inpaint_options_row_0 . update ( visible = v ) ,
200
192
inputs = [inp ['inpaint' ]],
201
193
outputs = [inpaint_options_row_0 ]
202
194
)
203
195
204
- def background_removal_options_visibility (v ):
205
- return bgrem_options_row_1 .update (visible = v ), \
206
- bgrem_options_row_2 .update (visible = v )
207
-
208
196
inp ['background_removal' ].change (
209
- fn = background_removal_options_visibility ,
197
+ fn = lambda v : ( bgrem_options_row_1 . update ( visible = v ), bgrem_options_row_2 . update ( visible = v )) ,
210
198
inputs = [inp ['background_removal' ]],
211
199
outputs = [bgrem_options_row_1 , bgrem_options_row_2 ]
212
200
)
@@ -215,7 +203,7 @@ def background_removal_options_visibility(v):
215
203
216
204
def on_ui_tabs ():
217
205
inp = GradioComponentBundle ()
218
- with gr .Blocks (analytics_enabled = False ) as depthmap_interface :
206
+ with gr .Blocks (analytics_enabled = False , title = "DepthMap" ) as depthmap_interface :
219
207
with gr .Row ().style (equal_height = False ):
220
208
with gr .Column (variant = 'panel' ):
221
209
inp += 'depthmap_mode' , gr .HTML (visible = False , value = '0' )
@@ -382,7 +370,7 @@ def run_generate(*inputs):
382
370
383
371
if depthmap_mode == '0' : # Single image
384
372
if depthmap_input_image is None :
385
- return [], None , None , "Please select an input image! "
373
+ return [], None , None , "Please select an input image"
386
374
inputimages .append (depthmap_input_image )
387
375
inputnames .append (None )
388
376
if custom_depthmap :
@@ -394,7 +382,7 @@ def run_generate(*inputs):
394
382
inputdepthmaps .append (None )
395
383
if depthmap_mode == '1' : # Batch Process
396
384
if image_batch is None :
397
- return [], None , None , "Please select input images! " , ""
385
+ return [], None , None , "Please select input images" , ""
398
386
for img in image_batch :
399
387
image = Image .open (os .path .abspath (img .name ))
400
388
inputimages .append (image )
0 commit comments