andresgtn commited on
Commit
ade9768
1 Parent(s): 71fb5d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -7,6 +7,8 @@ from io import BytesIO
7
  import torch
8
 
9
  pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4")
 
 
10
 
11
  def encode_pil_to_base64(pil_image):
12
  ''' From: https://github.com/gradio-app/gradio/blob/main/gradio/processing_utils.py'''
 
7
  import torch
8
 
9
  pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4")
10
+ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
11
+ pipe.to(device)
12
 
13
  def encode_pil_to_base64(pil_image):
14
  ''' From: https://github.com/gradio-app/gradio/blob/main/gradio/processing_utils.py'''