Hatman commited on
Commit
a1ad152
·
verified ·
1 Parent(s): 96ddc57

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -13,7 +13,7 @@ from torchvision import transforms
13
 
14
  device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
15
  dtype = torch.float16 if torch.cuda.is_available() else torch.float32
16
- pipeline = AutoPipelineForText2Image.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float32).to('cpu')
17
  pipeline.load_ip_adapter("h94/IP-Adapter", subfolder="sdxl_models", weight_name="ip-adapter_sdxl.bin")
18
 
19
  def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
@@ -49,7 +49,7 @@ def create_image(image_pil,
49
  pipeline.set_ip_adapter_scale(scale)
50
 
51
  style_image = load_image(image_pil)
52
- generator = torch.Generator(device='cpu').manual_seed(randomize_seed_fn(seed, True))
53
  torch.cuda.set_device(device)
54
  image = pipeline(
55
  prompt=prompt,
 
13
 
14
  device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
15
  dtype = torch.float16 if torch.cuda.is_available() else torch.float32
16
+ pipeline = AutoPipelineForText2Image.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float32).to('cuda:0')
17
  pipeline.load_ip_adapter("h94/IP-Adapter", subfolder="sdxl_models", weight_name="ip-adapter_sdxl.bin")
18
 
19
  def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
 
49
  pipeline.set_ip_adapter_scale(scale)
50
 
51
  style_image = load_image(image_pil)
52
+ generator = torch.Generator(device='cuda:0').manual_seed(randomize_seed_fn(seed, True))
53
  torch.cuda.set_device(device)
54
  image = pipeline(
55
  prompt=prompt,