mirror of
https://github.com/sd-webui/stable-diffusion-webui.git
synced 2024-12-15 15:22:55 +03:00
Merge branch 'master' of https://github.com/hlky/stable-diffusion-webui
This commit is contained in:
commit
3ea787b5d7
@ -47,8 +47,7 @@ def draw_gradio_ui(opt, img2img=lambda x: x, txt2img=lambda x: x,imgproc=lambda
|
|||||||
#_js=js_copy_to_clipboard( 'txt2img_gallery_output')
|
#_js=js_copy_to_clipboard( 'txt2img_gallery_output')
|
||||||
)
|
)
|
||||||
output_txt2img_copy_to_input_btn = gr.Button("Push to img2img")
|
output_txt2img_copy_to_input_btn = gr.Button("Push to img2img")
|
||||||
if RealESRGAN is not None:
|
output_txt2img_to_imglab = gr.Button("Send to Lab",visible=True)
|
||||||
output_txt2img_to_upscale_esrgan = gr.Button("Upscale w/ ESRGAN")
|
|
||||||
|
|
||||||
output_txt2img_params = gr.Highlightedtext(label="Generation parameters", interactive=False, elem_id='highlight')
|
output_txt2img_params = gr.Highlightedtext(label="Generation parameters", interactive=False, elem_id='highlight')
|
||||||
with gr.Group():
|
with gr.Group():
|
||||||
@ -320,7 +319,7 @@ def draw_gradio_ui(opt, img2img=lambda x: x, txt2img=lambda x: x,imgproc=lambda
|
|||||||
with gr.Column():
|
with gr.Column():
|
||||||
with gr.Tabs():
|
with gr.Tabs():
|
||||||
with gr.TabItem('Single Image'):
|
with gr.TabItem('Single Image'):
|
||||||
imgproc_source = gr.Image(label="Source", source="upload", interactive=True, type="pil")
|
imgproc_source = gr.Image(label="Source", source="upload", interactive=True, type="pil",elem_id="imglab_input")
|
||||||
|
|
||||||
#gfpgan_strength = gr.Slider(minimum=0.0, maximum=1.0, step=0.001, label="Effect strength",
|
#gfpgan_strength = gr.Slider(minimum=0.0, maximum=1.0, step=0.001, label="Effect strength",
|
||||||
# value=gfpgan_defaults['strength'])
|
# value=gfpgan_defaults['strength'])
|
||||||
@ -418,6 +417,14 @@ def draw_gradio_ui(opt, img2img=lambda x: x, txt2img=lambda x: x,imgproc=lambda
|
|||||||
[imgproc_source, imgproc_folder,imgproc_prompt,imgproc_toggles,
|
[imgproc_source, imgproc_folder,imgproc_prompt,imgproc_toggles,
|
||||||
imgproc_upscale_toggles,imgproc_realesrgan_model_name,imgproc_sampling, imgproc_steps, imgproc_height, imgproc_width, imgproc_cfg, imgproc_denoising, imgproc_seed,imgproc_gfpgan_strength],
|
imgproc_upscale_toggles,imgproc_realesrgan_model_name,imgproc_sampling, imgproc_steps, imgproc_height, imgproc_width, imgproc_cfg, imgproc_denoising, imgproc_seed,imgproc_gfpgan_strength],
|
||||||
[imgproc_output])
|
[imgproc_output])
|
||||||
|
output_txt2img_to_imglab.click(
|
||||||
|
uifn.copy_img_to_lab,
|
||||||
|
[output_txt2img_gallery],
|
||||||
|
[imgproc_source, tabs],
|
||||||
|
_js=call_JS("moveImageFromGallery",
|
||||||
|
fromId="txt2img_gallery_output",
|
||||||
|
toId="imglab_input")
|
||||||
|
)
|
||||||
if RealESRGAN is None:
|
if RealESRGAN is None:
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
with gr.Column():
|
with gr.Column():
|
||||||
|
@ -15,6 +15,16 @@ def update_image_mask(cropped_image, resize_mode, width, height):
|
|||||||
resized_cropped_image = resize_image(resize_mode, cropped_image, width, height) if cropped_image else None
|
resized_cropped_image = resize_image(resize_mode, cropped_image, width, height) if cropped_image else None
|
||||||
return gr.update(value=resized_cropped_image)
|
return gr.update(value=resized_cropped_image)
|
||||||
|
|
||||||
|
def copy_img_to_lab(img):
|
||||||
|
try:
|
||||||
|
image_data = re.sub('^data:image/.+;base64,', '', img)
|
||||||
|
processed_image = Image.open(BytesIO(base64.b64decode(image_data)))
|
||||||
|
tab_update = gr.update(selected='imgproc_tab')
|
||||||
|
img_update = gr.update(value=processed_image)
|
||||||
|
return processed_image, tab_update
|
||||||
|
except IndexError:
|
||||||
|
return [None, None]
|
||||||
|
|
||||||
def copy_img_to_input(img):
|
def copy_img_to_input(img):
|
||||||
try:
|
try:
|
||||||
image_data = re.sub('^data:image/.+;base64,', '', img)
|
image_data = re.sub('^data:image/.+;base64,', '', img)
|
||||||
|
6
webui.py
6
webui.py
@ -362,6 +362,8 @@ def try_loading_LDSR(model_name: str):
|
|||||||
import traceback
|
import traceback
|
||||||
print("Error loading LDSR:", file=sys.stderr)
|
print("Error loading LDSR:", file=sys.stderr)
|
||||||
print(traceback.format_exc(), file=sys.stderr)
|
print(traceback.format_exc(), file=sys.stderr)
|
||||||
|
else:
|
||||||
|
print("LDSR not found at path, please make sure you have cloned the LDSR repo to ./src/latent-diffusion/")
|
||||||
try_loading_LDSR('model')
|
try_loading_LDSR('model')
|
||||||
|
|
||||||
def load_SD_model():
|
def load_SD_model():
|
||||||
@ -1851,13 +1853,11 @@ txt2img_toggles = [
|
|||||||
'jpg samples',
|
'jpg samples',
|
||||||
]
|
]
|
||||||
|
|
||||||
"""
|
|
||||||
# removed for now becuase of Image Lab implementation
|
|
||||||
if GFPGAN is not None:
|
if GFPGAN is not None:
|
||||||
txt2img_toggles.append('Fix faces using GFPGAN')
|
txt2img_toggles.append('Fix faces using GFPGAN')
|
||||||
if RealESRGAN is not None:
|
if RealESRGAN is not None:
|
||||||
txt2img_toggles.append('Upscale images using RealESRGAN')
|
txt2img_toggles.append('Upscale images using RealESRGAN')
|
||||||
"""
|
|
||||||
txt2img_defaults = {
|
txt2img_defaults = {
|
||||||
'prompt': '',
|
'prompt': '',
|
||||||
'ddim_steps': 50,
|
'ddim_steps': 50,
|
||||||
|
Loading…
Reference in New Issue
Block a user