Ahmad Basyouni commited on
Commit
1580c57
1 Parent(s): 00d867b

Add application file

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -8,7 +8,8 @@ import numpy as np
8
  model_id = "CompVis/stable-diffusion-v1-4"
9
  default_scheduler = EulerAncestralDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
10
  pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=default_scheduler, torch_dtype=torch.float16)
11
- pipe = pipe.to("cuda")
 
12
 
13
  # Scheduler options
14
  schedulers = {
 
8
  model_id = "CompVis/stable-diffusion-v1-4"
9
  default_scheduler = EulerAncestralDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
10
  pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=default_scheduler, torch_dtype=torch.float16)
11
+ device = "cuda" if torch.cuda.is_available() else "cpu"
12
+ pipe = pipe.to(device)
13
 
14
  # Scheduler options
15
  schedulers = {