adetailer /
Jeffgold's picture
raw history blame
No virus
620 Bytes
from huggingface_hub import hf_hub_download
from ultralytics import YOLO
import cv2
from PIL import Image
import gradio as gr
def detect_objects(img):
# Download the model
path = hf_hub_download("Bingsu/adetailer", "")
model = YOLO(path)
# Run the model
output = model(img)
pred = output[0].plot()
pred = cv2.cvtColor(pred, cv2.COLOR_BGR2RGB)
pred = Image.fromarray(pred)
# Return the output
return pred
# Define a Gradio interface for the function
iface = gr.Interface(fn=detect_objects, inputs="image", outputs="image")
# Launch the interface