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')
|
||||
)
|
||||
output_txt2img_copy_to_input_btn = gr.Button("Push to img2img")
|
||||
if RealESRGAN is not None:
|
||||
output_txt2img_to_upscale_esrgan = gr.Button("Upscale w/ ESRGAN")
|
||||
output_txt2img_to_imglab = gr.Button("Send to Lab",visible=True)
|
||||
|
||||
output_txt2img_params = gr.Highlightedtext(label="Generation parameters", interactive=False, elem_id='highlight')
|
||||
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.Tabs():
|
||||
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",
|
||||
# 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_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])
|
||||
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:
|
||||
with gr.Row():
|
||||
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
|
||||
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):
|
||||
try:
|
||||
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
|
||||
print("Error loading LDSR:", 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')
|
||||
|
||||
def load_SD_model():
|
||||
@ -1851,13 +1853,11 @@ txt2img_toggles = [
|
||||
'jpg samples',
|
||||
]
|
||||
|
||||
"""
|
||||
# removed for now becuase of Image Lab implementation
|
||||
if GFPGAN is not None:
|
||||
txt2img_toggles.append('Fix faces using GFPGAN')
|
||||
if RealESRGAN is not None:
|
||||
txt2img_toggles.append('Upscale images using RealESRGAN')
|
||||
"""
|
||||
|
||||
txt2img_defaults = {
|
||||
'prompt': '',
|
||||
'ddim_steps': 50,
|
||||
|
Loading…
Reference in New Issue
Block a user