Spaces:
vilarin
/
Running on Zero

vilarin commited on
Commit
2845193
·
verified ·
1 Parent(s): 0756ffd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -32,7 +32,14 @@ JS = """function () {
32
  }
33
  }"""
34
 
35
- pipe = FluxPipeline.from_pretrained(model, torch_dtype=torch.bfloat16)
 
 
 
 
 
 
 
36
  pipe.load_lora_weights(default_lora, weight_name = default_weight_name) # default load lora
37
  pipe.fuse_lora(lora_scale=0.9)
38
 
 
32
  }
33
  }"""
34
 
35
+ if torch.cuda.is_available():
36
+ device = "cuda"
37
+ print("Using GPU")
38
+ else:
39
+ device = "cpu"
40
+ print("Using CPU")
41
+
42
+ pipe = FluxPipeline.from_pretrained(model, torch_dtype=torch.bfloat16).to(device)
43
  pipe.load_lora_weights(default_lora, weight_name = default_weight_name) # default load lora
44
  pipe.fuse_lora(lora_scale=0.9)
45