Skip to content

Commit

Permalink
fix: main model is missed in first generation after page refreshed
Browse files Browse the repository at this point in the history
  • Loading branch information
btian committed Jul 31, 2024
1 parent 9af837b commit 5c15a24
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion iz_helpers/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ def outpaint_steps(
def create_zoom(
request: gr.Request,
id_task,
model_title: str,
common_prompt_pre,
prompts_array,
common_prompt_suf,
Expand All @@ -200,12 +201,16 @@ def create_zoom(
upscale_do,
upscaler_name,
upscale_by,
main_sd_model,
inpainting_denoising_strength=1,
inpainting_full_res=0,
inpainting_padding=0,
progress=None,
):
model_title_prefix = 'model_title('
if model_title.startswith(model_title_prefix) and model_title.endswith(')'):
main_sd_model = model_title[len(model_title_prefix):-1]
else:
main_sd_model = model_title
result = [None, None, "", "", ""]
for i in range(batchcount):
print(f"{id_task}: Batch {i+1}/{batchcount}")
Expand Down
2 changes: 1 addition & 1 deletion iz_helpers/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ def on_ui_tabs():
_js="iz_submit",
inputs=[
id_task,
main_sd_model,
main_common_prompt_pre,
main_prompts,
main_common_prompt_suf,
Expand All @@ -333,7 +334,6 @@ def on_ui_tabs():
upscale_do,
upscaler_name,
upscale_by,
main_sd_model,
],
outputs=[output_video, out_image, generation_info, html_info, html_log, upgrade_info],
)
Expand Down
4 changes: 4 additions & 0 deletions javascript/infinite-zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ async function iz_submit() {
var id = randomId();
localStorage.setItem("iz_task_id", id);

const mainModel = gradioApp().querySelector("#sd_model_checkpoint_dropdown input");

var res = Array.from(arguments);
res[0] = id;
res[1] = `model_title(${mainModel.value})`;

return res;
}

Expand Down

0 comments on commit 5c15a24

Please sign in to comment.