Spaces:
Sleeping
Sleeping
| import gradio as gr, tempfile, shutil, os | |
| from ultralytics import YOLO | |
| model = YOLO('best.pt') | |
| def infer(video): | |
| tmp = tempfile.mkdtemp() | |
| inp = os.path.join(tmp, "in.mp4") | |
| shutil.copy(video, inp) | |
| res = model.predict(source=inp, save=True, conf=0.25, iou=0.45) | |
| return os.path.join(res.save_dir, "in.mp4") | |
| demo = gr.Interface( | |
| fn=infer, | |
| inputs=gr.Video(label="Sube tu video de inspecci贸n"), | |
| outputs=gr.Video(label="Video con defectos detectados"), | |
| title="Kesherat 路 Inspecci贸n de palas e贸licas", | |
| auth=[("admin","TuPassSecreta")] | |
| ) | |
| if __name__ == "__main__": | |
| demo.launch() | |