MCPcopy Create free account
hub / github.com/thygate/stable-diffusion-webui-depthmap-script / on_ui_tabs

Function on_ui_tabs

src/common_ui.py:276–431  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

274
275
276def on_ui_tabs():
277 inp = GradioComponentBundle()
278 with gr.Blocks(analytics_enabled=False, title="DepthMap", css=custom_css) as depthmap_interface:
279 with gr.Row(equal_height=False):
280 with gr.Column(variant='panel'):
281 inp += 'depthmap_mode', gr.HTML(visible=False, value='0')
282 with gr.Tabs():
283 with gr.TabItem('Single Image') as depthmap_mode_0:
284 with gr.Group():
285 with gr.Row():
286 inp += gr.Image(label="Source", source="upload", interactive=True, type="pil",
287 elem_id="depthmap_input_image")
288 # TODO: depthmap generation settings should disappear when using this
289 inp += gr.File(label="Custom DepthMap", file_count="single", interactive=True,
290 type="file", elem_id='custom_depthmap_img', visible=False)
291 inp += gr.Checkbox(elem_id="custom_depthmap", label="Use custom DepthMap", value=False)
292 with gr.TabItem('Batch Process') as depthmap_mode_1:
293 inp += gr.File(elem_id='image_batch', label="Batch Process", file_count="multiple",
294 interactive=True, type="file")
295 with gr.TabItem('Batch from Directory') as depthmap_mode_2:
296 inp += gr.Textbox(elem_id="depthmap_batch_input_dir", label="Input directory",
297 **backbone.get_hide_dirs(),
298 placeholder="A directory on the same machine where the server is running.")
299 inp += gr.Textbox(elem_id="depthmap_batch_output_dir", label="Output directory",
300 **backbone.get_hide_dirs(),
301 placeholder="Leave blank to save images to the default path.")
302 gr.HTML("Files in the output directory may be overwritten.")
303 inp += gr.Checkbox(elem_id="depthmap_batch_reuse",
304 label="Skip generation and use (edited/custom) depthmaps "
305 "in output directory when a file already exists.",
306 value=True)
307 with gr.TabItem('Single Video') as depthmap_mode_3:
308 inp = depthmap_mode_video(inp)
309 submit = gr.Button('Generate', elem_id="depthmap_generate", variant='primary')
310 inp |= main_ui_panel(True) # Main panel is inserted here
311 unloadmodels = gr.Button('Unload models', elem_id="depthmap_unloadmodels")
312
313 with gr.Column(variant='panel'):
314 with gr.Tabs(elem_id="mode_depthmap_output"):
315 with gr.TabItem('Depth Output'):
316 with gr.Group():
317 result_images = gr.Gallery(label='Output', show_label=False,
318 elem_id=f"depthmap_gallery", columns=4)
319 with gr.Column():
320 html_info = gr.HTML()
321 folder_symbol = '\U0001f4c2' # 📂
322 gr.Button(folder_symbol, visible=not backbone.get_cmd_opt('hide_ui_dir_config', False)).click(
323 fn=lambda: open_folder_action(), inputs=[], outputs=[],
324 )
325
326 with gr.TabItem('3D Mesh'):
327 with gr.Group():
328 result_depthmesh = gr.Model3D(label="3d Mesh", clear_color=[1.0, 1.0, 1.0, 1.0])
329 with gr.Row():
330 # loadmesh = gr.Button('Load')
331 clearmesh = gr.Button('Clear')
332
333 with gr.TabItem('Generate video'):

Callers

nothing calls this directly

Calls 6

enkey_tailMethod · 0.95
enkey_bodyMethod · 0.95
depthmap_mode_videoFunction · 0.85
main_ui_panelFunction · 0.85
open_folder_actionFunction · 0.85

Tested by

no test coverage detected