sandeepmajumdar commited on
Commit
ea10931
·
1 Parent(s): 045ff49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -4,9 +4,9 @@ from torch import autocast
4
  from diffusers import StableDiffusionPipeline
5
 
6
  model_id = "CompVis/stable-diffusion-v1-4"
7
- device = "cuda"
8
-
9
- pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token='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', torch_dtype=torch.float16, low_cpu_mem_usage=True)
10
  pipe = pipe.to(device)
11
 
12
  def inference(diffusion_prompt):
 
4
  from diffusers import StableDiffusionPipeline
5
 
6
  model_id = "CompVis/stable-diffusion-v1-4"
7
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, use_auth_token='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', torch_dtype=torch.float32, low_cpu_mem_usage=True)
8
+ has_cuda = torch.cuda.is_available()
9
+ device = torch.device('cpu' if not has_cuda else 'cuda')
10
  pipe = pipe.to(device)
11
 
12
  def inference(diffusion_prompt):