Skip to content

Commit

Permalink
Fix txt2img and img2img calls for auto v1.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
poipoi300 committed Aug 3, 2023
1 parent 0071435 commit 8e06748
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
14 changes: 10 additions & 4 deletions backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ def f_txt2img(req: Txt2ImgRequest):
0, # hr_second_pass_steps: 0 uses same num of steps as generation to refine details
req.orig_width, # hr_resize_x
req.orig_height, # hr_resize_y
get_sampler_index(req.sampler_name), # hr_sampler_index (different hr sampler not supported yet)
parse_prompt(req.prompt), # hr_prompt (different hr prompt not supported yet)
parse_prompt(req.negative_prompt), # hr_negative_prompt (different hr negative prompt not supported yet)
[], # override_settings_texts (unsupported)
req, # request, txt2img expects a gradio request object. Not 100% on what I'm even passing here but it works(TM).
*args,
)
images = output[0]
Expand Down Expand Up @@ -241,9 +245,7 @@ def f_img2img(req: Img2ImgRequest):

output = wrap_gradio_gpu_call(modules.img2img.img2img)(
"", # id_task (used by wrap_gradio_gpu_call for some sort of job id system)
4
if req.is_inpaint
else 0, # mode (we use 0 (img2img with init_img) & 4 (inpaint uploaded mask))
4 if req.is_inpaint else 0, # mode (we use 0 (img2img with init_img) & 4 (inpaint uploaded mask))
parse_prompt(req.prompt), # prompt
parse_prompt(req.negative_prompt), # negative_prompt
"None", # prompt_styles: saved prompt styles (unsupported)
Expand Down Expand Up @@ -272,7 +274,7 @@ def f_img2img(req: Img2ImgRequest):
req.seed_resize_from_h, # seed_resize_from_h
req.seed_resize_from_w, # seed_resize_from_w
req.seed_enable_extras, # seed_enable_extras
1, # selected_scale_tab
0, # selected_scale_tab
height, # height
width, # width
1.0, # scale_by
Expand All @@ -284,6 +286,10 @@ def f_img2img(req: Img2ImgRequest):
"", # img2img_batch_output_dir (unsupported)
"", # img2img_batch_inpaint_mask_dir (unsupported)
[], # override_settings_texts (unsupported)
False, # img2img_batch_use_png_info (unsupported)
[], # img2img_batch_png_info_props (unsupported)
"", # img2img_batch_png_info_dir (unsupported)
req, # request, img2img also expects a gradio request object. Not 100% on what I'm even passing here but it works(TM).
*args,
)
images = output[0]
Expand Down
4 changes: 4 additions & 0 deletions backend/structs.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class Txt2ImgRequest(DefaultTxt2ImgOptions):
"""Requested image width."""
orig_height: int
"""Requested image height."""
username: str = "krita"
"""Expected field in the request by txt2img and img2img for some high IQ reason, indubitably"""


@optional
Expand All @@ -38,6 +40,8 @@ class Img2ImgRequest(DefaultImg2ImgOptions):
"""Image being used."""
mask_img: Optional[str] = None
"""Image mask being used."""
username: str = "krita"
"""Expected field in the request by txt2img and img2img for some high IQ reason, indubitably"""


@optional
Expand Down

0 comments on commit 8e06748

Please sign in to comment.