import gradio as gr | |
import matplotlib.pyplot as plt | |
from PIL import Image | |
from ultralytics import YOLO | |
model = YOLO('best(1).pt') | |
def response(image): | |
results = model(image) | |
# Plot results image | |
im_bgr = results.plot() # BGR-order numpy array | |
im_rgb = im_bgr[..., ::-1] # Convert BGR to RGB | |
return im_rgb | |
iface = gr.Interface(fn=response, input="image", output="image") | |
iface.launch() |