Spaces:
Running
on
Zero
Running
on
Zero
LuJingyi-John
commited on
Commit
·
6fce8cc
1
Parent(s):
4b2ec41
Add title and project link to interface
Browse files- requirements.txt +1 -0
- utils/drag.py +3 -3
- utils/ui_utils.py +3 -1
requirements.txt
CHANGED
|
@@ -6,6 +6,7 @@ diffusers
|
|
| 6 |
accelerate
|
| 7 |
peft
|
| 8 |
xformers
|
|
|
|
| 9 |
|
| 10 |
# UI and Image Processing
|
| 11 |
gradio==3.47.1
|
|
|
|
| 6 |
accelerate
|
| 7 |
peft
|
| 8 |
xformers
|
| 9 |
+
spaces
|
| 10 |
|
| 11 |
# UI and Image Processing
|
| 12 |
gradio==3.47.1
|
utils/drag.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
|
|
|
|
|
| 1 |
import numpy as np
|
| 2 |
import cv2
|
| 3 |
import torch
|
| 4 |
from typing import Union
|
| 5 |
|
| 6 |
-
import spaces
|
| 7 |
-
|
| 8 |
def contour_to_points_and_mask(contour: np.ndarray, image_shape: tuple) -> tuple[np.ndarray, np.ndarray]:
|
| 9 |
"""Convert a contour to a set of points and binary mask.
|
| 10 |
|
|
@@ -189,7 +189,7 @@ def get_points_within_image_bounds(
|
|
| 189 |
|
| 190 |
return valid_points_mask
|
| 191 |
|
| 192 |
-
@spaces.GPU
|
| 193 |
def bi_warp(
|
| 194 |
region_mask: np.ndarray,
|
| 195 |
control_points: Union[np.ndarray, torch.Tensor],
|
|
|
|
| 1 |
+
import spaces
|
| 2 |
+
|
| 3 |
import numpy as np
|
| 4 |
import cv2
|
| 5 |
import torch
|
| 6 |
from typing import Union
|
| 7 |
|
|
|
|
|
|
|
| 8 |
def contour_to_points_and_mask(contour: np.ndarray, image_shape: tuple) -> tuple[np.ndarray, np.ndarray]:
|
| 9 |
"""Convert a contour to a set of points and binary mask.
|
| 10 |
|
|
|
|
| 189 |
|
| 190 |
return valid_points_mask
|
| 191 |
|
| 192 |
+
@spaces.GPU
|
| 193 |
def bi_warp(
|
| 194 |
region_mask: np.ndarray,
|
| 195 |
control_points: Union[np.ndarray, torch.Tensor],
|
utils/ui_utils.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import pickle
|
| 3 |
from time import perf_counter
|
|
@@ -12,7 +14,7 @@ from diffusers import AutoPipelineForInpainting, AutoencoderTiny, LCMScheduler
|
|
| 12 |
|
| 13 |
from utils.drag import bi_warp
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
__all__ = [
|
| 18 |
'clear_all', 'resize',
|
|
|
|
| 1 |
+
import spaces
|
| 2 |
+
|
| 3 |
import os
|
| 4 |
import pickle
|
| 5 |
from time import perf_counter
|
|
|
|
| 14 |
|
| 15 |
from utils.drag import bi_warp
|
| 16 |
|
| 17 |
+
|
| 18 |
|
| 19 |
__all__ = [
|
| 20 |
'clear_all', 'resize',
|