img2img fixed

This commit is contained in:
hlky 2022-09-07 03:08:29 +01:00
parent cf754f9fe6
commit 3b490df708
No known key found for this signature in database
GPG Key ID: 55A99F1E80D907D5
3 changed files with 16 additions and 16 deletions

View File

@ -33,9 +33,9 @@ dependencies:
- facexlib>=0.2.3
- python-slugify>=6.1.2
- streamlit>=1.12.2
- taming-transformers>=0.0.1
- openai-clip>=1.0.1
- gfpgan>=1.3.5
- realesrgan>=0.2.5.0
- -e git+https://github.com/CompVis/taming-transformers#egg=taming-transformers
- -e git+https://github.com/openai/CLIP#egg=clip
- -e git+https://github.com/TencentARC/GFPGAN#egg=GFPGAN
- -e git+https://github.com/xinntao/Real-ESRGAN#egg=realesrgan
- -e git+https://github.com/hlky/k-diffusion-sd#egg=k_diffusion
- -e .
- -e .

View File

@ -158,10 +158,10 @@ def draw_gradio_ui(opt, img2img=lambda x: x, txt2img=lambda x: x,imgproc=lambda
with gr.Row().style(equal_height=False):
with gr.Column():
gr.Markdown('#### Img2Img Input')
img2img_image_editor = gr.Image(value=sample_img2img, source="upload", interactive=True,
type="pil", tool="select", elem_id="img2img_editor", image_mode="RGBA"
)
img2img_image_mask = gr.Image(value=sample_img2img, source="upload", interactive=True,
type="pil", tool="sketch", elem_id="img2img_editor", image_mode="RGBA"
)
img2img_image_editor = gr.Image(value=sample_img2img, source="upload", interactive=False,
type="pil", tool="sketch", visible=False, image_mode="RGBA",
elem_id="img2img_mask")
@ -169,10 +169,10 @@ def draw_gradio_ui(opt, img2img=lambda x: x, txt2img=lambda x: x,imgproc=lambda
with gr.TabItem("Editor Options"):
with gr.Row():
img2img_image_editor_mode = gr.Radio(choices=["Mask", "Crop", "Uncrop"], label="Image Editor Mode",
value="Crop", elem_id='edit_mode_select')
value="Mask", elem_id='edit_mode_select', visible=False)
img2img_mask = gr.Radio(choices=["Keep masked area", "Regenerate only masked area"],
label="Mask Mode", type="index",
value=img2img_mask_modes[img2img_defaults['mask_mode']], visible=False)
value=img2img_mask_modes[img2img_defaults['mask_mode']], visible=True)
img2img_mask_blur_strength = gr.Slider(minimum=1, maximum=10, step=1,
label="How much blurry should the mask be? (to avoid hard edges)",
@ -181,7 +181,7 @@ def draw_gradio_ui(opt, img2img=lambda x: x, txt2img=lambda x: x,imgproc=lambda
img2img_resize = gr.Radio(label="Resize mode",
choices=["Just resize", "Crop and resize", "Resize and fill"],
type="index",
value=img2img_resize_modes[img2img_defaults['resize_mode']])
value=img2img_resize_modes[img2img_defaults['resize_mode']], visible=False)
img2img_painterro_btn = gr.Button("Advanced Editor")
with gr.TabItem("Hints"):

View File

@ -1227,11 +1227,11 @@ class Flagging(gr.FlaggingCallback):
def img2img(prompt: str, image_editor_mode: str, mask_mode: str, mask_blur_strength: int, ddim_steps: int, sampler_name: str,
toggles: List[int], realesrgan_model_name: str, n_iter: int, cfg_scale: float, denoising_strength: float,
seed: int, height: int, width: int, resize_mode: int, init_info: any = None, init_info_mask: any = None, fp = None, job_info: JobInfo = None):
print([prompt, image_editor_mode, init_info, init_info_mask, mask_mode,
mask_blur_strength, ddim_steps, sampler_name, toggles,
realesrgan_model_name, n_iter, cfg_scale,
denoising_strength, seed, height, width, resize_mode,
fp])
# print([prompt, image_editor_mode, init_info, init_info_mask, mask_mode,
# mask_blur_strength, ddim_steps, sampler_name, toggles,
# realesrgan_model_name, n_iter, cfg_scale,
# denoising_strength, seed, height, width, resize_mode,
# fp])
outpath = opt.outdir_img2img or opt.outdir or "outputs/img2img-samples"
err = False
seed = seed_to_int(seed)