carddh / app.py
nomypython's picture
Update app.py
53399a4 verified
raw
history blame contribute delete
448 Bytes
import gradio as gr
from ultralytics import YOLO
import os
# Download the model from Google Drive if it's not present
model_path = "best.pt"
# Load the YOLOv8 model
model = YOLO(model_path)
# Define the object detection function
def detect_objects(image):
results = model(image)
return results[0].plot()
# Create a Gradio interface
app = gr.Interface(fn=detect_objects, inputs="image", outputs="image")
# Launch Gradio app
app.launch()