From 9dbf7ad986dc540073026576682de859467f6790 Mon Sep 17 00:00:00 2001 From: Friday <3270939387@qq.com> Date: Fri, 22 Sep 2023 21:38:55 +0800 Subject: [PATCH] sd --- README.md | 6 ++++-- Stable_diff_text2image.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3d057b1..3101075 100644 --- a/README.md +++ b/README.md @@ -59,9 +59,11 @@ pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float #pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config) -prompt = "an orange cat"/“a corgi” +prompt = "an orange cat" -image = pipe(prompt).images[0] image.save("orange_cat.png"/“corgi.png”) +image = pipe(prompt).images[0] + +image.save("orange_cat.png") ``` . diff --git a/Stable_diff_text2image.py b/Stable_diff_text2image.py index 9a081c4..1e7df6f 100644 --- a/Stable_diff_text2image.py +++ b/Stable_diff_text2image.py @@ -8,7 +8,7 @@ log = logging.getLogger(PyOperator) class StableDiffusion(PyOperator): def __init__(self,model_id='stabilityai/stable-diffusion-2-1',pipe='StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32'): self._model_id=model_id - self.pipe = pipe + self._pipe = pipe def __call__(self, prompt:str): # pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)