John6666 commited on
Commit
45c0511
β€’
1 Parent(s): f71b71d

Upload genimage.py

Browse files
Files changed (1) hide show
  1. genimage.py +5 -4
genimage.py CHANGED
@@ -2,11 +2,12 @@ import spaces
2
 
3
 
4
  def load_pipeline():
5
- from diffusers import StableDiffusionXLPipeline
6
  import torch
7
  device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
8
- pipe = StableDiffusionXLPipeline.from_pretrained(
9
  "John6666/rae-diffusion-xl-v2-sdxl-spo-pcm",
 
10
  torch_dtype=torch.float16,
11
  )
12
  pipe.to(device)
@@ -43,8 +44,8 @@ def generate_image(prompt, neg_prompt):
43
  }
44
  try:
45
  images = pipe(
46
- prompt=prompt + ", masterpiece, best quality, very aesthetic, absurdres",
47
- negative_prompt=neg_prompt + ", bad hands, bad foots, lowres, (bad), text, error, fewer, extra, missing, worst quality, jpeg artifacts, low quality, watermark, unfinished, displeasing, oldest, early, chromatic aberration, signature, extra digits, artistic error, username, scan, [abstract], photo, deformed, disfigured, low contrast, photo, deformed, disfigured, low contrast",
48
  width=1024,
49
  height=1024,
50
  guidance_scale=7.5,
 
2
 
3
 
4
  def load_pipeline():
5
+ from diffusers import AutoPipelineForText2Image
6
  import torch
7
  device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
8
+ pipe = AutoPipelineForText2Image.from_pretrained(
9
  "John6666/rae-diffusion-xl-v2-sdxl-spo-pcm",
10
+ custom_pipeline="lpw_stable_diffusion_xl",
11
  torch_dtype=torch.float16,
12
  )
13
  pipe.to(device)
 
44
  }
45
  try:
46
  images = pipe(
47
+ prompt=prompt + ", anime, masterpiece, best quality, very aesthetic, absurdres",
48
+ negative_prompt=neg_prompt + ", bad hands, bad feet, lowres, (bad), text, error, fewer, extra, missing, worst quality, jpeg artifacts, low quality, watermark, unfinished, displeasing, oldest, early, chromatic aberration, signature, extra digits, artistic error, username, scan, [abstract], photo, deformed, disfigured, low contrast, photo, deformed, disfigured, low contrast",
49
  width=1024,
50
  height=1024,
51
  guidance_scale=7.5,