import mmpose import os 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!") result = next(result_generator) print(os.listdir()) print(result['visualization']) return result['visualization'] # # 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()