Skip to content

Commit

Permalink
FIX minor bug in stable_diffusion_xl.py (#903)
Browse files Browse the repository at this point in the history
The `inference` function saves the PIL image with format jpeg. The `web_inference` function sets an `image/jpeg` content type. The `main` cli entrypoint saves these *bytes* as a png. Doesn't actually matter in almost every case since file name isn't really used in python for inferring format, or in general. But this fixes it for clarity
  • Loading branch information
jbn authored Oct 1, 2024
1 parent 4638793 commit 5648e6d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion 06_gpu_and_ml/stable_diffusion/stable_diffusion_xl.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def main(prompt: str = "Unicorns and leprechauns sign a peace treaty"):
if not dir.exists():
dir.mkdir(exist_ok=True, parents=True)

output_path = dir / "output.png"
output_path = dir / "output.jpg"
print(f"Saving it to {output_path}")
with open(output_path, "wb") as f:
f.write(image_bytes)
Expand Down

0 comments on commit 5648e6d

Please sign in to comment.