JojiJoseph commited on
Commit
cb1e9a1
·
verified ·
1 Parent(s): 990a1ac

Check if cuda is available

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -7,7 +7,10 @@ pipe = StableDiffusionPipeline.from_pretrained(
7
  safety_checker=None,
8
  torch_dtype=torch.float16,
9
  use_safetensors=True,
10
- ).to("cuda")
 
 
 
11
 
12
 
13
  def generate_image(text):
 
7
  safety_checker=None,
8
  torch_dtype=torch.float16,
9
  use_safetensors=True,
10
+ )
11
+
12
+ if torch.cuda.is_available():
13
+ pipe.to("cuda")
14
 
15
 
16
  def generate_image(text):