Spaces:
Running
on
Zero
Running
on
Zero
rlawjdghek
commited on
Commit
β’
dae78dc
1
Parent(s):
f9d01c1
no apply net
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
|
2 |
import os
|
3 |
import sys
|
4 |
import time
|
@@ -23,7 +23,7 @@ sys.path.insert(0, str(PROJECT_ROOT))
|
|
23 |
from preprocess.detectron2.projects.DensePose.apply_net_gradio import DensePose4Gradio
|
24 |
from preprocess.humanparsing.run_parsing import Parsing
|
25 |
from preprocess.openpose.run_openpose import OpenPose
|
26 |
-
import apply_net
|
27 |
print("app import done")
|
28 |
|
29 |
os.environ['GRADIO_TEMP_DIR'] = './tmp' # TODO: turn off when final upload
|
@@ -118,15 +118,15 @@ def process_hd(vton_img, garm_img, n_steps):
|
|
118 |
stt = time.time()
|
119 |
print('get densepose... ', end='')
|
120 |
vton_img = vton_img.resize((IMG_W, IMG_H)) # size for densepose
|
121 |
-
|
122 |
|
123 |
-
human_img_arg = _apply_exif_orientation(vton_img.resize((IMG_W, IMG_H)))
|
124 |
-
human_img_arg = convert_PIL_to_numpy(human_img_arg, format="BGR")
|
125 |
-
args = apply_net.create_argument_parser().parse_args(('show', './configs/densepose_rcnn_R_50_FPN_s1x.yaml', './ckpt/densepose/model_final_162be9.pkl', 'dp_segm', '-v', '--opts', 'MODEL.DEVICE', 'cuda'))
|
126 |
# verbosity = getattr(args, "verbosity", None)
|
127 |
-
pose_img = args.func(args, human_img_arg)
|
128 |
-
pose_img = pose_img[:, :, ::-1]
|
129 |
-
pose_img = Image.fromarray(pose_img).resize((IMG_W, IMG_H))
|
130 |
|
131 |
print('%.2fs' % (time.time() - stt))
|
132 |
|
|
|
1 |
+
import spaces
|
2 |
import os
|
3 |
import sys
|
4 |
import time
|
|
|
23 |
from preprocess.detectron2.projects.DensePose.apply_net_gradio import DensePose4Gradio
|
24 |
from preprocess.humanparsing.run_parsing import Parsing
|
25 |
from preprocess.openpose.run_openpose import OpenPose
|
26 |
+
# import apply_net
|
27 |
print("app import done")
|
28 |
|
29 |
os.environ['GRADIO_TEMP_DIR'] = './tmp' # TODO: turn off when final upload
|
|
|
118 |
stt = time.time()
|
119 |
print('get densepose... ', end='')
|
120 |
vton_img = vton_img.resize((IMG_W, IMG_H)) # size for densepose
|
121 |
+
densepose = densepose_model_hd.execute(vton_img) # densepose
|
122 |
|
123 |
+
# human_img_arg = _apply_exif_orientation(vton_img.resize((IMG_W, IMG_H)))
|
124 |
+
# human_img_arg = convert_PIL_to_numpy(human_img_arg, format="BGR")
|
125 |
+
# args = apply_net.create_argument_parser().parse_args(('show', './configs/densepose_rcnn_R_50_FPN_s1x.yaml', './ckpt/densepose/model_final_162be9.pkl', 'dp_segm', '-v', '--opts', 'MODEL.DEVICE', 'cuda'))
|
126 |
# verbosity = getattr(args, "verbosity", None)
|
127 |
+
# pose_img = args.func(args, human_img_arg)
|
128 |
+
# pose_img = pose_img[:, :, ::-1]
|
129 |
+
# pose_img = Image.fromarray(pose_img).resize((IMG_W, IMG_H))
|
130 |
|
131 |
print('%.2fs' % (time.time() - stt))
|
132 |
|