File size: 794 Bytes
cce6568
9bd545d
853d801
 
cce6568
61a57f9
9bd545d
2d705cc
008456d
853d801
3adf147
 
9bd545d
 
 
 
853d801
44b0a93
853d801
 
44b0a93
 
 
853d801
44b0a93
9bd545d
44b0a93
853d801
44b0a93
 
 
cce6568
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import gradio as gr
from ultralytics import YOLO
from PIL import Image
import numpy as np


model = YOLO('mouseFeetDetection.pt')  

# Define the prediction function for YOLO model
def predict(image):
    if image is None:
        return None
    image = Image.fromarray(np.array(image))  
    results = model(image) 
    annotated_image = results[0].plot()  
    return Image.fromarray(annotated_image) 

description = """
Welcome to the Gradio interface! This simple app detects mouse feet observing from below.
Upload an image to see the prediction results!
"""

demo = gr.Interface(
    fn=predict, 
    inputs=gr.Image(label="Upload an Image"), 
    outputs=gr.Image(label="Prediction Result"),
    live=True,
    title="Mouse Feet Detection",
    description=description
)

demo.launch()