From 02791aa784f82d10dc98e3cc09468fee3aa7693c Mon Sep 17 00:00:00 2001 From: Ki <73854284+ki-arie@users.noreply.github.com> Date: Sun, 20 Nov 2022 21:46:32 +1300 Subject: [PATCH] Minor change to Imagic Readme Missing dir causes an error when running the example code. --- examples/community/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/community/README.md b/examples/community/README.md index dc35d36a953d..4985ca53e95d 100644 --- a/examples/community/README.md +++ b/examples/community/README.md @@ -399,6 +399,7 @@ import requests from PIL import Image from io import BytesIO import torch +import os from diffusers import DiffusionPipeline, DDIMScheduler has_cuda = torch.cuda.is_available() device = torch.device('cpu' if not has_cuda else 'cuda') @@ -423,6 +424,7 @@ res = pipe.train( num_inference_steps=50, generator=generator) res = pipe(alpha=1) +os.makedirs("imagic", exist_ok=True) image = res.images[0] image.save('./imagic/imagic_image_alpha_1.png') res = pipe(alpha=1.5) @@ -652,4 +654,4 @@ prompt = "a cup" # the masked out region will be replaced with this with autocast("cuda"): image = pipe(image=image, text=text, prompt=prompt).images[0] -``` \ No newline at end of file +```