Spaces:
Running
on
Zero
Running
on
Zero
enable zerogpu
Browse files
app.py
CHANGED
@@ -254,7 +254,7 @@ hands = mp_hands.Hands(
|
|
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,7 +367,7 @@ def get_ref_anno(ref):
|
|
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,7 +498,7 @@ def reset_kps(img, keypoints, side: Literal["right", "left"]):
|
|
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,7 +541,7 @@ def sample_diff(ref_cond, target_cond, target_keypts, num_gen, seed, cfg):
|
|
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,7 +696,7 @@ def switch_mask_size(radio):
|
|
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,
|
|
|
254 |
min_detection_confidence=0.1,
|
255 |
)
|
256 |
|
257 |
+
@spaces.GPU(duration=120)
|
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(duration=120)
|
371 |
def get_target_anno(target):
|
372 |
if target is None:
|
373 |
return (
|
|
|
498 |
keypoints[1] = []
|
499 |
return img, keypoints
|
500 |
|
501 |
+
@spaces.GPU(duration=120)
|
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(duration=120)
|
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(duration=120)
|
700 |
def sample_inpaint(
|
701 |
ref_cond,
|
702 |
target_cond,
|