Skip to content

Commit

Permalink
added low-res-fix using tile-- let's see if it fixes or not
Browse files Browse the repository at this point in the history
  • Loading branch information
usamaehsan committed Nov 19, 2023
1 parent e63a439 commit 06ede0b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,11 +485,10 @@ def predict(
if output.nsfw_content_detected and output.nsfw_content_detected[0]:
continue

output_path = f"/tmp/seed-{this_seed}.png"
if low_res_fix:
print("Running low res fix...")
start = time.time()
seed= torch.manual_seed(0)
seed_= int.from_bytes(os.urandom(2), "big")
condition_image = self.resize_for_condition_image(output.images[0], low_res_fix_resolution)
print("condition image resize took", time.time() - start, "seconds")
tile_output= self.tile_pipe(
Expand All @@ -500,11 +499,14 @@ def predict(
width=condition_image.size[0],
height=condition_image.size[1],
controlnet_conditioning_scale=1.0,
generator=seed,
generator=torch.manual_seed(seed_),
)

path = f"/tmp/low-res-{seed_}.png"
print("low-res-fix took", time.time() - start, "seconds")
tile_output.images[0].save(output_path)
else:
tile_output.images[0].save(path)
output_paths.append(Path(path))
# else:
# if consistency_decoder:
# print("Running consistency decoder...")
# start = time.time()
Expand All @@ -514,8 +516,9 @@ def predict(
# print("Consistency decoder took", time.time() - start, "seconds")
# save_image(sample, output_path)
# else:
output.images[0].save(output_path)


output_path = f"/tmp/seed-{this_seed}.png"
output.images[0].save(output_path)
output_paths.append(Path(output_path))

if len(output_paths) == 0:
Expand Down

0 comments on commit 06ede0b

Please sign in to comment.