File size: 1,013 Bytes
afd2199 31fdeeb afd2199 31fdeeb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
import mmpose
print(mmpose.__version__)
from mmpose.apis import MMPoseInferencer
inferencer = MMPoseInferencer('human')
print("[INFO]: Imported modules!")
import gradio as gr
def greet(photo):
print("[INFO]: Downloaded models!")
result_generator = inferencer(photo)
print("[INFO]: Visualizing results!")
vis, pred = next(result_generator)
return vis
# # specify detection model by alias
# # the available aliases include 'human', 'hand', 'face', 'animal',
# # as well as any additional aliases defined in mmdet
# inferencer = MMPoseInferencer(
# # suppose the pose estimator is trained on custom dataset
# pose2d='custom_human_pose_estimator.py',
# pose2d_weights='custom_human_pose_estimator.pth',
# det_model='human'
# )
def run():
demo = gr.Interface(fn=greet,
inputs=gr.Image(source="webcam"),
outputs=gr.Image())
demo.launch(server_name="0.0.0.0", server_port=7860)
if __name__ == "__main__":
run() |