Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import gradio as gr
|
| 3 |
+
from ultralytics import YOLO
|
| 4 |
+
|
| 5 |
+
# Load model (weights must be in repo)
|
| 6 |
+
model = YOLO("best.pt")
|
| 7 |
+
|
| 8 |
+
def predict(image):
|
| 9 |
+
results = model.predict(image, conf=0.25)
|
| 10 |
+
return results[0].plot()
|
| 11 |
+
|
| 12 |
+
iface = gr.Interface(
|
| 13 |
+
fn=predict,
|
| 14 |
+
inputs=gr.Image(type="filepath"),
|
| 15 |
+
outputs=gr.Image(type="numpy"),
|
| 16 |
+
title="Pothole Detection with YOLOv8"
|
| 17 |
+
)
|
| 18 |
+
|
| 19 |
+
if __name__ == "__main__":
|
| 20 |
+
iface.launch()
|