VcRlAgent commited on
Commit
17b5079
·
1 Parent(s): e0b1280

Rollback Working except Avatar

Browse files
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -56,10 +56,15 @@ def load_models():
56
  )
57
 
58
  # Stable Diffusion Img2Img pipeline (public model)
59
- sd_pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
60
- "runwayml/stable-diffusion-v1-5",
61
- torch_dtype=torch.float16
62
- ).to(device)
 
 
 
 
 
63
 
64
  # Optimize for ZeroGPU memory
65
  sd_pipe.enable_attention_slicing()
 
56
  )
57
 
58
  # Stable Diffusion Img2Img pipeline (public model)
59
+ device = "cuda" if torch.cuda.is_available() else "cpu"
60
+ if device == "cuda":
61
+ sd_pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
62
+ "runwayml/stable-diffusion-v1-5",
63
+ torch_dtype=torch.float16
64
+ ).to(device)
65
+ else:
66
+ sd_pipe = StableDiffusionImg2ImgPipeline.from_pretrained(
67
+ "runwayml/stable-diffusion-v1-5").to(device)
68
 
69
  # Optimize for ZeroGPU memory
70
  sd_pipe.enable_attention_slicing()