@@ -217,6 +217,25 @@ def update_delault_net_size(model_type):
217
217
218
218
return inp
219
219
220
+ def open_folder_action ():
221
+ # Adapted from stable-diffusion-webui
222
+ f = backbone .get_outpath ()
223
+ if backbone .get_cmd_opt ('hide_ui_dir_config' , False ):
224
+ return
225
+ if not os .path .exists (f ) or not os .path .isdir (f ):
226
+ raise "Couldn't open output folder" # .isdir is security-related, do not remove!
227
+ import platform
228
+ import subprocess as sp
229
+ path = os .path .normpath (f )
230
+ if platform .system () == "Windows" :
231
+ os .startfile (path )
232
+ elif platform .system () == "Darwin" :
233
+ sp .Popen (["open" , path ])
234
+ elif "microsoft-standard-WSL2" in platform .uname ().release :
235
+ sp .Popen (["wsl-open" , path ])
236
+ else :
237
+ sp .Popen (["xdg-open" , path ])
238
+
220
239
def on_ui_tabs ():
221
240
inp = GradioComponentBundle ()
222
241
with gr .Blocks (analytics_enabled = False , title = "DepthMap" ) as depthmap_interface :
@@ -260,6 +279,10 @@ def on_ui_tabs():
260
279
elem_id = f"depthmap_gallery" ).style (grid = 4 )
261
280
with gr .Column ():
262
281
html_info = gr .HTML ()
282
+ folder_symbol = '\U0001f4c2 ' # 📂
283
+ gr .Button (folder_symbol , visible = not backbone .get_cmd_opt ('hide_ui_dir_config' , False )).click (
284
+ fn = lambda : open_folder_action (), inputs = [], outputs = [],
285
+ )
263
286
264
287
with gr .TabItem ('3D Mesh' ):
265
288
with gr .Group ():
@@ -301,6 +324,7 @@ def on_ui_tabs():
301
324
submit_vid = gr .Button ('Generate Video' , elem_id = "depthmap_generatevideo" ,
302
325
variant = 'primary' )
303
326
327
+
304
328
inp += inp .enkey_tail ()
305
329
306
330
depthmap_mode_0 .select (lambda : '0' , None , inp ['depthmap_mode' ])
@@ -401,7 +425,7 @@ def run_generate(*inputs):
401
425
inputimages .append (image )
402
426
inputnames .append (os .path .splitext (img .orig_name )[0 ])
403
427
elif depthmap_mode == '2' : # Batch from Directory
404
- assert not backbone .get_opt ('hide_ui_dir_config' , False ), '--hide-ui-dir-config option must be disabled'
428
+ assert not backbone .get_cmd_opt ('hide_ui_dir_config' , False ), '--hide-ui-dir-config option must be disabled'
405
429
if depthmap_batch_input_dir == '' :
406
430
return [], None , None , "Please select an input directory."
407
431
if depthmap_batch_input_dir == depthmap_batch_output_dir :
0 commit comments