Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,17 @@
|
|
|
|
1 |
import torch, torchvision
|
2 |
import sys
|
3 |
# sys.path.insert(0, 'test_mmpose/')
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
10 |
import mmpose
|
11 |
import gradio as gr
|
12 |
|
@@ -27,6 +32,7 @@ pose_model = init_pose_model(pose_config, pose_checkpoint, device='cuda')
|
|
27 |
# initialize detector
|
28 |
det_model = init_detector(det_config, det_checkpoint, device='cuda')
|
29 |
|
|
|
30 |
def predict(img):
|
31 |
mmdet_results = inference_detector(det_model, img)
|
32 |
person_results = process_mmdet_results(mmdet_results, cat_id=1)
|
@@ -121,7 +127,7 @@ article = ""
|
|
121 |
demo = gr.Interface(fn=predict,
|
122 |
inputs=gr.Image(),
|
123 |
outputs=[gr.Image(label='Prediction'), gr.Image(label='Poses')],
|
124 |
-
examples=example_list,
|
125 |
title=title,
|
126 |
description=description,
|
127 |
article=article)
|
|
|
1 |
+
import spaces
|
2 |
import torch, torchvision
|
3 |
import sys
|
4 |
# sys.path.insert(0, 'test_mmpose/')
|
5 |
+
|
6 |
+
@spaces.GPU
|
7 |
+
def prepare():
|
8 |
+
try:
|
9 |
+
from mmcv.ops import get_compiling_cuda_version, get_compiler_version
|
10 |
+
except:
|
11 |
+
import mim
|
12 |
+
mim.install('mmcv-full==1.5.0')
|
13 |
+
prepare()
|
14 |
+
|
15 |
import mmpose
|
16 |
import gradio as gr
|
17 |
|
|
|
32 |
# initialize detector
|
33 |
det_model = init_detector(det_config, det_checkpoint, device='cuda')
|
34 |
|
35 |
+
@spaces.GPU
|
36 |
def predict(img):
|
37 |
mmdet_results = inference_detector(det_model, img)
|
38 |
person_results = process_mmdet_results(mmdet_results, cat_id=1)
|
|
|
127 |
demo = gr.Interface(fn=predict,
|
128 |
inputs=gr.Image(),
|
129 |
outputs=[gr.Image(label='Prediction'), gr.Image(label='Poses')],
|
130 |
+
#examples=example_list,
|
131 |
title=title,
|
132 |
description=description,
|
133 |
article=article)
|