harpomaxx commited on
Commit
89e5ee7
1 Parent(s): d960a05

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -120,7 +120,8 @@ with gr.Blocks() as demo:
120
  )
121
 
122
  if __name__ == "__main__":
123
-
124
- pipe = StableDiffusionPipeline.from_single_file(PATH,torch_dtype=torch.float16).to("cuda")
 
125
  demo.queue(concurrency_count=2,
126
  ).launch()
 
120
  )
121
 
122
  if __name__ == "__main__":
123
+ # Check if CUDA is available
124
+ device = "cuda" if torch.cuda.is_available() else "cpu"
125
+ pipe = StableDiffusionPipeline.from_single_file(PATH,torch_dtype=torch.float16).to(device)
126
  demo.queue(concurrency_count=2,
127
  ).launch()