Spaces:
Runtime error
Runtime error
Upload 8 files
Browse filesFiles changed (8)
2 unmodified lines3456789101112678910111213141523 unmodified lines3940414242434445144 unmodified lines19019119219319319419539 unmodified lines23523623723924023823924024124224324424624524624724826 unmodified lines27527627727928027827928028128232 unmodified lines31531631731932031831932032132232 unmodified lines35535635735936035835936036136232 unmodified lines39539639739940039839940040140232 unmodified lines43543643743944043843944044144272 unmodified lines5155165175195185215195205215226 unmodified lines5295305315345325335345356 unmodified lines5425435445475455465475486 unmodified lines5555565575605585595605616 unmodified lines5685695705735715725735746 unmodified lines5815825835865845855865876 unmodified lines5945955965995975985996002 unmodified linesfrom utils.text2image import stable_diffusion_text2imgfrom utils.inpaint import stable_diffusion_inpaint
from controlnet.controlnet_canny import stable_diffusion_controlnet_img2imgfrom controlnet.controlnet_depth import stable_diffusion_controlnet_img2imgfrom controlnet.controlnet_hed import stable_diffusion_controlnet_img2imgfrom controlnet.controlnet_mlsd import stable_diffusion_controlnet_img2imgfrom controlnet.controlnet_pose import stable_diffusion_controlnet_img2imgfrom controlnet.controlnet_scribble import stable_diffusion_controlnet_img2imgfrom controlnet.controlnet_seg import stable_diffusion_controlnet_img2imgfrom controlnet.controlnet_canny import stable_diffusion_controlnet_cannyfrom controlnet.controlnet_depth import stable_diffusion_controlnet_depthfrom controlnet.controlnet_hed import stable_diffusion_controlnet_hedfrom controlnet.controlnet_mlsd import stable_diffusion_controlnet_mlsdfrom controlnet.controlnet_pose import stable_diffusion_controlnet_posefrom controlnet.controlnet_scribble import stable_diffusion_controlnet_scribblefrom controlnet.controlnet_seg import stable_diffusion_controlnet_seg
import gradio as gr23 unmodified lines ]app = gr.Blocks()with app: gr.Markdown("# **<h2 align='center'>Stable Diffusion + ControlNet WebUI<h2>**") gr.Markdown("# **<h2 align='center'>Stable Diffusion WebUI<h2>**") gr.Markdown( """ <h5 style='text-align: center'>144 unmodified lines
inpaint_predict = gr.Button(value='Generator')
with gr.Tab('ControlNet'): with gr.Tab('Canny'): controlnet_canny_image_file = gr.Image(label='Image')39 unmodified lines controlnet_hed_image_file = gr.Image(label='Image')
controlnet_hed_model_id = gr.Dropdown( choices=stable_prompt_list, value=stable_prompt_list[0], choices=stable_model_list, value=stable_model_list[0], label='Stable Model Id' )
controlnet_hed_prompt = gr.Textbox( lines=1, value=stable_prompt_list[0], value=stable_model_list[0], label='Prompt' )
26 unmodified lines controlnet_mlsd_image_file = gr.Image(label='Image')
controlnet_mlsd_model_id = gr.Dropdown( choices=stable_prompt_list, value=stable_prompt_list[0], choices=stable_model_list, value=stable_model_list[0], label='Stable Model Id' )
32 unmodified lines controlnet_seg_image_file = gr.Image(label='Image')
controlnet_seg_model_id = gr.Dropdown( choices=stable_prompt_list, value=stable_prompt_list[0], choices=stable_model_list, value=stable_model_list[0], label='Stable Model Id' )
32 unmodified lines controlnet_depth_image_file = gr.Image(label='Image')
controlnet_depth_model_id = gr.Dropdown( choices=stable_prompt_list, value=stable_prompt_list[0], choices=stable_model_list, value=stable_model_list[0], label='Stable Model Id' )
32 unmodified lines controlnet_scribble_image_file = gr.Image(label='Image')
controlnet_scribble_model_id = gr.Dropdown( choices=stable_prompt_list, value=stable_prompt_list[0], choices=stable_model_list, value=stable_model_list[0], label='Stable Model Id' )
32 unmodified lines controlnet_pose_image_file = gr.Image(label='Image')
controlnet_pose_model_id = gr.Dropdown( choices=stable_prompt_list, value=stable_prompt_list[0], choices=stable_model_list, value=stable_model_list[0], label='Stable Model Id' )
72 unmodified lines outputs = [output_image], )
controlnet_canny_predict.click( fn = stable_diffusion_controlnet_img2img, fn = stable_diffusion_controlnet_canny, inputs = [ controlnet_canny_image_file, controlnet_canny_model_id, 6 unmodified lines )
controlnet_hed_predict.click( fn = stable_diffusion_controlnet_img2img, fn = stable_diffusion_controlnet_hed, inputs = [ controlnet_hed_image_file, controlnet_hed_model_id, 6 unmodified lines ) controlnet_mlsd_predict.click( fn = stable_diffusion_controlnet_img2img, fn = stable_diffusion_controlnet_mlsd, inputs = [ controlnet_mlsd_image_file, controlnet_mlsd_model_id, 6 unmodified lines ) controlnet_seg_predict.click( fn = stable_diffusion_controlnet_img2img, fn = stable_diffusion_controlnet_seg, inputs = [ controlnet_seg_image_file, controlnet_seg_model_id, 6 unmodified lines ) controlnet_depth_predict.click( fn = stable_diffusion_controlnet_img2img, fn = stable_diffusion_controlnet_depth, inputs = [ controlnet_depth_image_file, controlnet_depth_model_id, 6 unmodified lines ) controlnet_scribble_predict.click( fn = stable_diffusion_controlnet_img2img, fn = stable_diffusion_controlnet_scribble, inputs = [ controlnet_scribble_image_file, controlnet_scribble_model_id, 6 unmodified lines ) controlnet_pose_predict.click( fn = stable_diffusion_controlnet_img2img, fn = stable_diffusion_controlnet_pose, inputs = [ controlnet_pose_image_file, controlnet_pose_model_id, 26 unmodified lines272829303031323326 unmodified lines return controlnet, image
def stable_diffusion_controlnet_img2img(def stable_diffusion_controlnet_canny( stable_model_path:str, image_path:str, prompt:str,23 unmodified lines242526272728293023 unmodified lines
return controlnet, image
def stable_diffusion_controlnet_img2img(def stable_diffusion_controlnet_depth( stable_model_path:str, image_path:str, prompt:str,12323457697899 unmodified lines1920212522232425from diffusers import ( StableDiffusionControlNetPipeline, ControlNetModel, UniPCMultistepScheduler, DDIMScheduler) ControlNetModel, UniPCMultistepScheduler)
from controlnet_aux import HEDdetectorfrom PIL import Imageimport numpy as npimport torchimport cv2
def controlnet_hed(image_path:str):9 unmodified lines return controlnet, image
def stable_diffusion_controlnet_img2img(def stable_diffusion_controlnet_hed( stable_model_path:str, image_path:str, prompt:str,12323457697899 unmodified lines1920212522232425from diffusers import ( StableDiffusionControlNetPipeline, ControlNetModel, UniPCMultistepScheduler, DDIMScheduler) ControlNetModel, UniPCMultistepScheduler)
from controlnet_aux import MLSDdetectorfrom PIL import Imageimport numpy as npimport torchimport cv2
def controlnet_mlsd(image_path:str):9 unmodified lines
return controlnet, image
def stable_diffusion_controlnet_img2img(def stable_diffusion_controlnet_mlsd( stable_model_path:str, image_path:str, prompt:str,19 unmodified lines202122232324252619 unmodified lines
return controlnet, image
def stable_diffusion_controlnet_img2img(def stable_diffusion_controlnet_pose( stable_model_path:str, image_path:str, prompt:str,123234513 unmodified lines1920212322232425from diffusers import ( StableDiffusionControlNetPipeline, ControlNetModel, UniPCMultistepScheduler, DDIMScheduler) ControlNetModel, UniPCMultistepScheduler)
from controlnet_aux import HEDdetector
13 unmodified lines
return controlnet, image
def stable_diffusion_controlnet_img2img(def stable_diffusion_controlnet_scribble( stable_model_path:str, image_path:str, prompt:str,77 unmodified lines787980818182838477 unmodified lines return controlnet, image
def stable_diffusion_controlnet_img2img(def stable_diffusion_controlnet_seg( stable_model_path:str, image_path:str, prompt:str,app.py+28-30
controlnet/controlnet_canny.py+1-1
controlnet/controlnet_depth.py+1-1
controlnet/controlnet_hed.py+2-5
controlnet/controlnet_mlsd.py+2-5
controlnet/controlnet_pose.py+1-1
controlnet/controlnet_scribble.py+2-3
controlnet/controlnet_seg.py+1-1