Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -19,11 +19,11 @@ pipe = DiffusionPipeline.from_pretrained(
|
|
19 |
pipe.to("cuda")
|
20 |
pipe.load_lora_weights(prj_path, weight_name="pytorch_lora_weights.safetensors")
|
21 |
|
22 |
-
refiner = StableDiffusionXLImg2ImgPipeline.from_pretrained(
|
23 |
-
"stabilityai/stable-diffusion-xl-refiner-1.0",
|
24 |
-
torch_dtype=torch.float16,
|
25 |
-
)
|
26 |
-
refiner.to("cuda")
|
27 |
|
28 |
|
29 |
def generate_image(prompt, seed=None):
|
@@ -32,8 +32,8 @@ def generate_image(prompt, seed=None):
|
|
32 |
|
33 |
seed = int(seed)
|
34 |
generator = torch.Generator("cuda").manual_seed(seed)
|
35 |
-
image = pipe(prompt=prompt, generator=generator).images[0]
|
36 |
-
image = refiner(prompt=prompt, generator=generator, image=image).images[0]
|
37 |
name = f"{seed}_{str(uuid.uuid4())}.png"
|
38 |
save_path = f"images/{name}"
|
39 |
image.save(save_path)
|
|
|
19 |
pipe.to("cuda")
|
20 |
pipe.load_lora_weights(prj_path, weight_name="pytorch_lora_weights.safetensors")
|
21 |
|
22 |
+
#refiner = StableDiffusionXLImg2ImgPipeline.from_pretrained(
|
23 |
+
# "stabilityai/stable-diffusion-xl-refiner-1.0",
|
24 |
+
# torch_dtype=torch.float16,
|
25 |
+
#)
|
26 |
+
#refiner.to("cuda")
|
27 |
|
28 |
|
29 |
def generate_image(prompt, seed=None):
|
|
|
32 |
|
33 |
seed = int(seed)
|
34 |
generator = torch.Generator("cuda").manual_seed(seed)
|
35 |
+
image = pipe(prompt=prompt, generator=generator, num_inference_steps=25).images[0]
|
36 |
+
#image = refiner(prompt=prompt, generator=generator, image=image).images[0]
|
37 |
name = f"{seed}_{str(uuid.uuid4())}.png"
|
38 |
save_path = f"images/{name}"
|
39 |
image.save(save_path)
|