File size: 598 Bytes
253e609
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from ultralytics import YOLO
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
import gradio as gr

model=YOLO('yolov10n.pt')
def predict_image(image):
    np_image=np.array(image)
    results=model.predict(source=np_image)
    result_images=results[0].plot()
    return result_images

iface=gr.Interface(
    fn=predict_image,
    inputs=gr.Image(type='pil', label="Chon mot tep anh? "),
    outputs=gr.Image(type='pil', label="Anh dau ra"),
    title="YOLOv10 Object Detection",
    description="Chon mot tep anh de nhan dien doi tuong"
)
iface.launch()