File size: 448 Bytes
fc7f6fa
 
 
 
53399a4
ab60bae
53399a4
 
ab60bae
fc7f6fa
 
 
 
53399a4
fc7f6fa
ab60bae
53399a4
fc7f6fa
 
53399a4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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()