multimodalart HF staff commited on
Commit
d986994
·
verified ·
1 Parent(s): b2c0d50

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -34,7 +34,11 @@ pipe = StableDiffusion3Pipeline.from_pretrained(
34
  torch_dtype=torch.bfloat16
35
  )
36
 
37
- ip_model = IPAdapter(pipe, image_encoder_path, ipadapter_path, device="cuda", num_tokens=128)
 
 
 
 
38
 
39
  def resize_img(image, max_size=1024):
40
  width, height = image.size
@@ -68,13 +72,13 @@ def process_image(
68
  image = resize_img(image)
69
 
70
  # Generate the image
71
- result = ip_model.generate(
72
- pil_image=image,
73
  prompt=prompt,
74
- scale=scale,
75
  width=width,
76
  height=height,
77
- seed=seed
78
  )
79
 
80
  return result[0], seed
 
34
  torch_dtype=torch.bfloat16
35
  )
36
 
37
+ pipe.init_ipadapter(
38
+ ip_adapter_path=ip_adapter_path,
39
+ image_encoder_path=image_encoder_path,
40
+ nb_token=64,
41
+ )
42
 
43
  def resize_img(image, max_size=1024):
44
  width, height = image.size
 
72
  image = resize_img(image)
73
 
74
  # Generate the image
75
+ result = pipe(
76
+ clip_image=image,
77
  prompt=prompt,
78
+ ipadapter_scale=scale,
79
  width=width,
80
  height=height,
81
+ generator=torch.Generator("cuda").manual_seed(seed)
82
  )
83
 
84
  return result[0], seed