File size: 322 Bytes
e2bd5a8 1e7b2ff e2bd5a8 |
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("best0709.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(show_api=True)
|