Spaces:
Sleeping
Sleeping
IZERE HIRWA Roger
commited on
Commit
·
63775e2
1
Parent(s):
0f522d6
kk
Browse files
app.py
CHANGED
|
@@ -29,11 +29,12 @@ def load_models():
|
|
| 29 |
|
| 30 |
if sd_pipe is None:
|
| 31 |
print("Loading Stable Diffusion model...")
|
|
|
|
| 32 |
sd_pipe = StableDiffusionInpaintPipeline.from_pretrained(
|
| 33 |
"stabilityai/stable-diffusion-2-inpainting",
|
| 34 |
-
torch_dtype=torch.float16,
|
| 35 |
safety_checker=None
|
| 36 |
-
).to(
|
| 37 |
|
| 38 |
return predictor, sd_pipe
|
| 39 |
|
|
|
|
| 29 |
|
| 30 |
if sd_pipe is None:
|
| 31 |
print("Loading Stable Diffusion model...")
|
| 32 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 33 |
sd_pipe = StableDiffusionInpaintPipeline.from_pretrained(
|
| 34 |
"stabilityai/stable-diffusion-2-inpainting",
|
| 35 |
+
torch_dtype=torch.float16 if device == "cuda" else torch.float32,
|
| 36 |
safety_checker=None
|
| 37 |
+
).to(device)
|
| 38 |
|
| 39 |
return predictor, sd_pipe
|
| 40 |
|