multimodalart HF staff commited on
Commit
28fa58e
1 Parent(s): 5bb6a56

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -13,6 +13,7 @@ from kolors.models.unet_2d_condition import UNet2DConditionModel
13
  from diffusers import AutoencoderKL, EulerDiscreteScheduler
14
 
15
  from huggingface_hub import snapshot_download
 
16
 
17
  device = "cuda" if torch.cuda.is_available() else "cpu"
18
  root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -58,6 +59,7 @@ pipe.load_ip_adapter(f'{root_dir}/weights/Kolors-IP-Adapter-Plus', subfolder="",
58
  MAX_SEED = np.iinfo(np.int32).max
59
  MAX_IMAGE_SIZE = 1024
60
 
 
61
  def infer(prompt, ip_adapter_image, negative_prompt="", seed=42, randomize_seed=False, width=1024, height=1024, guidance_scale=5.0, num_inference_steps=50, ip_adapter_scale=0.5, progress=gr.Progress(track_tqdm=True)):
62
  if randomize_seed:
63
  seed = random.randint(0, MAX_SEED)
 
13
  from diffusers import AutoencoderKL, EulerDiscreteScheduler
14
 
15
  from huggingface_hub import snapshot_download
16
+ import spaces
17
 
18
  device = "cuda" if torch.cuda.is_available() else "cpu"
19
  root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
 
59
  MAX_SEED = np.iinfo(np.int32).max
60
  MAX_IMAGE_SIZE = 1024
61
 
62
+ @spaces.GPU
63
  def infer(prompt, ip_adapter_image, negative_prompt="", seed=42, randomize_seed=False, width=1024, height=1024, guidance_scale=5.0, num_inference_steps=50, ip_adapter_scale=0.5, progress=gr.Progress(track_tqdm=True)):
64
  if randomize_seed:
65
  seed = random.randint(0, MAX_SEED)