Skip to content

Commit

Permalink
Fix image upscale issue
Browse files Browse the repository at this point in the history
  • Loading branch information
konieshadow committed Oct 24, 2023
1 parent 50c2c03 commit 1f142b5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion fooocus_api_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = '0.1.18'
version = '0.1.19'
28 changes: 19 additions & 9 deletions fooocusapi/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,10 @@ def build_advanced_parameters():
if direct_return:
d = [('Upscale (Fast)', '2x')]
log(uov_input_image, d, single_line_number=1)
outputs.append(['results', [uov_input_image]])
return
outputs.append(['results', [uov_input_image], -1 if len(tasks) == 0 else tasks[0]['task_seed']])
results = make_results_from_outputs()
task_queue.finish_task(task_seq, results, False)
return results * image_number

tiled = True
denoising_strength = 0.382
Expand Down Expand Up @@ -455,7 +457,9 @@ def build_advanced_parameters():

if advanced_parameters.debugging_cn_preprocessor:
outputs.append(['results', inpaint_worker.current_task.visualize_mask_processing()])
return
results = []
task_queue.finish_task(task_seq, results, False)
return results

progressbar(13, 'VAE Inpaint encoding ...')

Expand Down Expand Up @@ -500,17 +504,21 @@ def build_advanced_parameters():
cn_img = HWC3(cn_img)
task[0] = core.numpy_to_pytorch(cn_img)
if advanced_parameters.debugging_cn_preprocessor:
outputs.append(['results', [cn_img]])
return
outputs.append(['results', [cn_img], task['task_seed']])
results = make_results_from_outputs()
task_queue.finish_task(task_seq, results, False)
return results
for task in cn_tasks[flags.cn_cpds]:
cn_img, cn_stop, cn_weight = task
cn_img = resize_image(HWC3(cn_img), width=width, height=height)
cn_img = preprocessors.cpds(cn_img)
cn_img = HWC3(cn_img)
task[0] = core.numpy_to_pytorch(cn_img)
if advanced_parameters.debugging_cn_preprocessor:
outputs.append(['results', [cn_img]])
return
outputs.append(['results', [cn_img], task['task_seed']])
results = make_results_from_outputs()
task_queue.finish_task(task_seq, results, False)
return results
for task in cn_tasks[flags.cn_ip]:
cn_img, cn_stop, cn_weight = task
cn_img = HWC3(cn_img)
Expand All @@ -520,8 +528,10 @@ def build_advanced_parameters():

task[0] = ip_adapter.preprocess(cn_img)
if advanced_parameters.debugging_cn_preprocessor:
outputs.append(['results', [cn_img]])
return
outputs.append(['results', [cn_img], task['task_seed']])
results = make_results_from_outputs()
task_queue.finish_task(task_seq, results, False)
return results

if len(cn_tasks[flags.cn_ip]) > 0:
pipeline.final_unet = ip_adapter.patch_model(pipeline.final_unet, cn_tasks[flags.cn_ip])
Expand Down

0 comments on commit 1f142b5

Please sign in to comment.