File size: 547 Bytes
8c56298 06bb803 8c56298 |
1 2 3 4 5 6 7 8 9 10 11 12 |
import torch
import gradio as gr
model = torch.hub.load('./', 'custom', 'best.pt',force_reload=True, source='local',trust_repo=True)
examples=[["photo/a.jpg","Image1"],["photo/b.jpg","Image2"],
["photo/c.jpg","Image3"],["photo/d.jpg","Image4"],
["photo/e.jpg","Image5"],["photo/f.jpg","Image6"],
["photo/g.jpg","Image7"],["photo/h.jpg","Image8"]]
io=gr.Interface(fn=lambda img:model(img).render()[0],inputs=["image"],title="Yolov7 Custom Object Detection",examples=examples,outputs=["image"],).launch()
io.launch() |