File size: 519 Bytes
f14a1ad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr
from ultralytics import YOLO

# Load the YOLO model
model = YOLO('best.pt')

def predict(img):

    results = model(img)
    annotated_frame = results[0].plot()
    return annotated_frame

# Create the Gradio interface
iface = gr.Interface(
    fn=predict,
    inputs=gr.Image(label="Input Image", type="filepath"),
    outputs="image",
    title="Rat Paw Detector",
    description="Upload an image to detect rat paws"
)

# Launch the Gradio interface
iface.launch(share=True)