@@ -217,6 +217,25 @@ def update_delault_net_size(model_type):
217217
218218 return inp
219219
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+
220239def on_ui_tabs ():
221240 inp = GradioComponentBundle ()
222241 with gr .Blocks (analytics_enabled = False , title = "DepthMap" ) as depthmap_interface :
@@ -260,6 +279,10 @@ def on_ui_tabs():
260279 elem_id = f"depthmap_gallery" ).style (grid = 4 )
261280 with gr .Column ():
262281 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+ )
263286
264287 with gr .TabItem ('3D Mesh' ):
265288 with gr .Group ():
@@ -301,6 +324,7 @@ def on_ui_tabs():
301324 submit_vid = gr .Button ('Generate Video' , elem_id = "depthmap_generatevideo" ,
302325 variant = 'primary' )
303326
327+
304328 inp += inp .enkey_tail ()
305329
306330 depthmap_mode_0 .select (lambda : '0' , None , inp ['depthmap_mode' ])
@@ -401,7 +425,7 @@ def run_generate(*inputs):
401425 inputimages .append (image )
402426 inputnames .append (os .path .splitext (img .orig_name )[0 ])
403427 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'
405429 if depthmap_batch_input_dir == '' :
406430 return [], None , None , "Please select an input directory."
407431 if depthmap_batch_input_dir == depthmap_batch_output_dir :
0 commit comments