johnowhitaker commited on
Commit
a81b4f4
1 Parent(s): 45ac70d

Add device check

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -6,6 +6,8 @@ from PIL import Image, ImageColor
6
  from diffusers import DDPMPipeline
7
  from diffusers import DDIMScheduler
8
 
 
 
9
  # Load the pretrained pipeline
10
  pipeline_name = 'johnowhitaker/sd-class-wikiart-from-bedrooms'
11
  image_pipe = DDPMPipeline.from_pretrained(pipeline_name).to(device)
 
6
  from diffusers import DDPMPipeline
7
  from diffusers import DDIMScheduler
8
 
9
+ device = 'mps' if torch.backends.mps.is_available() else 'cuda' if torch.cuda.is_available() else 'cpu'
10
+
11
  # Load the pretrained pipeline
12
  pipeline_name = 'johnowhitaker/sd-class-wikiart-from-bedrooms'
13
  image_pipe = DDPMPipeline.from_pretrained(pipeline_name).to(device)