Chaerin5 commited on
Commit
da82f44
·
1 Parent(s): 8579aa2

enable zerogpu

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -20,6 +20,7 @@ from copy import deepcopy
20
  from typing import Optional
21
  import requests
22
  from huggingface_hub import hf_hub_download
 
23
 
24
  MAX_N = 6
25
  FIX_MAX_N = 6
@@ -253,7 +254,7 @@ hands = mp_hands.Hands(
253
  min_detection_confidence=0.1,
254
  )
255
 
256
-
257
  def get_ref_anno(ref):
258
  if ref is None:
259
  return (
@@ -366,7 +367,7 @@ def get_ref_anno(ref):
366
 
367
  return img, ref_pose, ref_cond
368
 
369
-
370
  def get_target_anno(target):
371
  if target is None:
372
  return (
@@ -497,7 +498,7 @@ def reset_kps(img, keypoints, side: Literal["right", "left"]):
497
  keypoints[1] = []
498
  return img, keypoints
499
 
500
-
501
  def sample_diff(ref_cond, target_cond, target_keypts, num_gen, seed, cfg):
502
  set_seed(seed)
503
  z = torch.randn(
@@ -540,7 +541,7 @@ def sample_diff(ref_cond, target_cond, target_keypts, num_gen, seed, cfg):
540
  results_pose.append(placeholder)
541
  return results, results_pose
542
 
543
-
544
  def ready_sample(img_ori, inpaint_mask, keypts):
545
  img = cv2.resize(img_ori[..., :3], opts.image_size, interpolation=cv2.INTER_AREA)
546
  sam_predictor.set_image(img)
@@ -695,7 +696,7 @@ def switch_mask_size(radio):
695
  out = (gr.update(visible=True), gr.update(visible=False))
696
  return out
697
 
698
-
699
  def sample_inpaint(
700
  ref_cond,
701
  target_cond,
 
20
  from typing import Optional
21
  import requests
22
  from huggingface_hub import hf_hub_download
23
+ import spaces
24
 
25
  MAX_N = 6
26
  FIX_MAX_N = 6
 
254
  min_detection_confidence=0.1,
255
  )
256
 
257
+ @spaces.GPU
258
  def get_ref_anno(ref):
259
  if ref is None:
260
  return (
 
367
 
368
  return img, ref_pose, ref_cond
369
 
370
+ @spaces.GPU
371
  def get_target_anno(target):
372
  if target is None:
373
  return (
 
498
  keypoints[1] = []
499
  return img, keypoints
500
 
501
+ @spaces.GPU
502
  def sample_diff(ref_cond, target_cond, target_keypts, num_gen, seed, cfg):
503
  set_seed(seed)
504
  z = torch.randn(
 
541
  results_pose.append(placeholder)
542
  return results, results_pose
543
 
544
+ @spaces.GPU
545
  def ready_sample(img_ori, inpaint_mask, keypts):
546
  img = cv2.resize(img_ori[..., :3], opts.image_size, interpolation=cv2.INTER_AREA)
547
  sam_predictor.set_image(img)
 
696
  out = (gr.update(visible=True), gr.update(visible=False))
697
  return out
698
 
699
+ @spaces.GPU
700
  def sample_inpaint(
701
  ref_cond,
702
  target_cond,