new test dicler
Browse files
main.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import mmpose
|
2 |
+
print(mmpose.__version__)
|
3 |
+
from mmpose.apis import MMPoseInferencer
|
4 |
+
inferencer = MMPoseInferencer('human')
|
5 |
+
print("[INFO]: Imported modules!!")
|
6 |
+
|
7 |
+
import gradio as gr
|
8 |
+
|
9 |
+
def greet(photo):
|
10 |
+
print("[INFO]: Downloaded models!")
|
11 |
+
result_generator = inferencer(photo)
|
12 |
+
|
13 |
+
print("[INFO]: Visualizing results!")
|
14 |
+
vis, pred = next(result_generator)
|
15 |
+
return vis
|
16 |
+
|
17 |
+
# # specify detection model by alias
|
18 |
+
# # the available aliases include 'human', 'hand', 'face', 'animal',
|
19 |
+
# # as well as any additional aliases defined in mmdet
|
20 |
+
# inferencer = MMPoseInferencer(
|
21 |
+
# # suppose the pose estimator is trained on custom dataset
|
22 |
+
# pose2d='custom_human_pose_estimator.py',
|
23 |
+
# pose2d_weights='custom_human_pose_estimator.pth',
|
24 |
+
# det_model='human'
|
25 |
+
# )
|
26 |
+
if __name__ == '__main__':
|
27 |
+
|
28 |
+
demo = gr.Interface(fn=greet, inputs=gr.Image(source="webcam"), outputs=gr.Image())
|
29 |
+
|
30 |
+
demo.launch()
|