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()