|
import mmpose |
|
import os |
|
from mmpose.apis import MMPoseInferencer |
|
|
|
print("[INFO]: Imported modules!") |
|
|
|
import gradio as gr |
|
|
|
def poses(photo): |
|
inferencer = MMPoseInferencer('human') |
|
|
|
print("[INFO]: Downloaded models!") |
|
print(photo) |
|
result_generator = inferencer(photo, |
|
out_dir =".") |
|
|
|
print("[INFO]: Visualizing results!") |
|
|
|
|
|
result = next(result_generator) |
|
print(type(result)) |
|
print(result['visualization']) |
|
print(type(result['visualization'])) |
|
print(result['visualization'][0]) |
|
print(type(result['visualization'][0])) |
|
return result['visualization'][0] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run(): |
|
|
|
demo = gr.Interface(fn=poses, |
|
inputs=gr.Image(source="webcam"), |
|
outputs=gr.Image()) |
|
|
|
|
|
demo.launch(server_name="0.0.0.0", server_port=7860) |
|
|
|
|
|
if __name__ == "__main__": |
|
run() |