Spaces:
Running
Running
File size: 998 Bytes
0b4a225 0c634b8 0b4a225 |
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 |
import gradio as gr
import PIL.Image as Image
from ultralytics import YOLO
pose = YOLO("models/pose.pt")
def predict_image(image, conf_threshold, iou_threshold):
results = pose.predict(
image, conf=conf_threshold, iou=iou_threshold, stream=True)
for r in results:
im_array = r.plot(labels=True, boxes=True)
yield Image.fromarray(im_array[..., ::-1])
iface = gr.Interface(
fn=predict_image,
inputs=[
gr.Video(label="Upload Video"),
gr.Slider(minimum=0, maximum=1, value=0.25,
label="Confidence threshold"),
gr.Slider(minimum=0, maximum=1, value=0.7, label="IoU threshold"),
],
outputs=gr.Image(type="numpy", label="Result"),
title="Human Pose",
description="Limbs in all of the right places. Videos may take a LOT of time since this is running on the basic CPU tier of HuggingFace. Feel free to check out the image space for a much faster demo!"
)
if __name__ == "__main__":
iface.launch()
|