Rojban commited on
Commit
0c2f8e1
Β·
1 Parent(s): 31def33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
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):
@@ -33,7 +33,7 @@ def generate_image(prompt, seed=None):
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)
 
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):
 
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)