Hatman commited on
Commit
ac8d8ef
·
verified ·
1 Parent(s): 70a52dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -14,9 +14,10 @@ def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
14
  seed = random.randint(0, 2000)
15
  return seed
16
 
17
- device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
18
- pipeline = AutoPipelineForText2Image.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float16).to(device)
19
- pipeline.load_ip_adapter("h94/IP-Adapter", subfolder="sdxl_models", weight_name="ip-adapter_sdxl.bin", device=device)
 
20
 
21
  @spaces.GPU()
22
  def create_image(image_pil,
 
14
  seed = random.randint(0, 2000)
15
  return seed
16
 
17
+ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
18
+ dtype = torch.float16 if torch.cuda.is_available() else torch.float32
19
+ pipeline = AutoPipelineForText2Image.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=dtype).to(device)
20
+ pipeline.load_ip_adapter("h94/IP-Adapter", subfolder="sdxl_models", weight_name="ip-adapter_sdxl.bin", device=device, dtype=dtype)
21
 
22
  @spaces.GPU()
23
  def create_image(image_pil,