Paper99 cbensimon HF staff commited on
Commit
8a564e4
1 Parent(s): 9360364

ZeroGPU (#2)

Browse files

- ZeroGPU (60194002829110930c22f857d81ab53aa7471d93)


Co-authored-by: Charles Bensimon <cbensimon@users.noreply.huggingface.co>

Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -47,13 +47,14 @@ pipe.load_photomaker_adapter(
47
  weight_name=os.path.basename(photomaker_ckpt),
48
  trigger_word="img"
49
  )
 
50
 
51
  pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
52
  pipe.load_lora_weights(os.path.dirname(lora_path), weight_name=lora_model_name, adapter_name="xl_more_art-full")
53
  pipe.set_adapters(["photomaker", "xl_more_art-full"], adapter_weights=[1.0, 0.5])
54
  pipe.fuse_lora()
55
 
56
- @spaces.GPU(enable_queue=True)
57
  def generate_image(upload_images, prompt, negative_prompt, style_name, num_steps, style_strength_ratio, num_outputs, guidance_scale, seed, progress=gr.Progress(track_tqdm=True)):
58
  # check the trigger word
59
  image_token_id = pipe.tokenizer.convert_tokens_to_ids(pipe.trigger_word)
 
47
  weight_name=os.path.basename(photomaker_ckpt),
48
  trigger_word="img"
49
  )
50
+ pipe.id_encoder.to(device)
51
 
52
  pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
53
  pipe.load_lora_weights(os.path.dirname(lora_path), weight_name=lora_model_name, adapter_name="xl_more_art-full")
54
  pipe.set_adapters(["photomaker", "xl_more_art-full"], adapter_weights=[1.0, 0.5])
55
  pipe.fuse_lora()
56
 
57
+ @spaces.GPU
58
  def generate_image(upload_images, prompt, negative_prompt, style_name, num_steps, style_strength_ratio, num_outputs, guidance_scale, seed, progress=gr.Progress(track_tqdm=True)):
59
  # check the trigger word
60
  image_token_id = pipe.tokenizer.convert_tokens_to_ids(pipe.trigger_word)