|
import gradio as gr |
|
from huggingface_hub import hf_hub_download |
|
from ultralytics import YOLO |
|
from supervision import Detections |
|
from PIL import Image |
|
model_path = hf_hub_download(repo_id="arnabdhar/YOLOv8-Face-Detection", filename="model.pt") |
|
model = YOLO(model_path) |
|
|
|
|
|
def greet(img): |
|
output = YOLO(img) |
|
results = Detections.from_ultralytics(output[0]) |
|
print(results) |
|
return results |
|
|
|
demo = gr.Interface(fn=greet, inputs="text", outputs="text") |
|
|
|
if __name__ == "__main__": |
|
demo.launch(show_api=False, share=True) |