Unverified Commit eb2425b8 authored by Ki's avatar Ki Committed by GitHub
Browse files

Update README.md: Minor change to Imagic code snippet, missing dir error (#1347)

Minor change to Imagic Readme

Missing dir causes an error when running the example code.
parent 44efcbda
...@@ -399,6 +399,7 @@ import requests ...@@ -399,6 +399,7 @@ import requests
from PIL import Image from PIL import Image
from io import BytesIO from io import BytesIO
import torch import torch
import os
from diffusers import DiffusionPipeline, DDIMScheduler from diffusers import DiffusionPipeline, DDIMScheduler
has_cuda = torch.cuda.is_available() has_cuda = torch.cuda.is_available()
device = torch.device('cpu' if not has_cuda else 'cuda') device = torch.device('cpu' if not has_cuda else 'cuda')
...@@ -423,6 +424,7 @@ res = pipe.train( ...@@ -423,6 +424,7 @@ res = pipe.train(
num_inference_steps=50, num_inference_steps=50,
generator=generator) generator=generator)
res = pipe(alpha=1) res = pipe(alpha=1)
os.makedirs("imagic", exist_ok=True)
image = res.images[0] image = res.images[0]
image.save('./imagic/imagic_image_alpha_1.png') image.save('./imagic/imagic_image_alpha_1.png')
res = pipe(alpha=1.5) res = pipe(alpha=1.5)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment