Spaces:
Sleeping
Sleeping
Kesheratmex
commited on
Commit
·
576a657
1
Parent(s):
7b98e66
Demo lista: añado peso best.pt y app.py final
Browse files- app.py +22 -0
- best.pt +3 -0
- requirements.txt +4 -0
app.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr, tempfile, shutil, os
|
| 2 |
+
from ultralytics import YOLO
|
| 3 |
+
|
| 4 |
+
model = YOLO('best.pt')
|
| 5 |
+
|
| 6 |
+
def infer(video):
|
| 7 |
+
tmp = tempfile.mkdtemp()
|
| 8 |
+
inp = os.path.join(tmp, "in.mp4")
|
| 9 |
+
shutil.copy(video, inp)
|
| 10 |
+
res = model.predict(source=inp, save=True, conf=0.25, iou=0.45)
|
| 11 |
+
return os.path.join(res.save_dir, "in.mp4")
|
| 12 |
+
|
| 13 |
+
demo = gr.Interface(
|
| 14 |
+
fn=infer,
|
| 15 |
+
inputs=gr.Video(label="Sube tu video de inspección"),
|
| 16 |
+
outputs=gr.Video(label="Video con defectos detectados"),
|
| 17 |
+
title="Kesherat · Inspección de palas eólicas",
|
| 18 |
+
auth=[("admin","TuPassSecreta")]
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
if __name__ == "__main__":
|
| 22 |
+
demo.launch()
|
best.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5ad65ce6ac661119de11077619c2e785958f5a3d1e029452d18a57c7407db3c6
|
| 3 |
+
size 136764521
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
ultralytics==8.2.0
|
| 2 |
+
gradio>=4.0
|
| 3 |
+
opencv-python-headless
|
| 4 |
+
huggingface_hub
|