File size: 309 Bytes
449dc64
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import torch
from ultralytics import YOLO
import gradio as gr

model = YOLO("best0625.pt")  # 或者是從 hf_hub_download 取得

def detect(image):
    results = model(image)
    return results[0].plot()  # 回傳帶框圖像

iface = gr.Interface(fn=detect, inputs="image", outputs="image")
iface.launch()