Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- app.py +20 -0
- best.pt +3 -0
- requirements.txt +5 -0
app.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from ultralytics import YOLO
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
# Download the model from Google Drive if it's not present
|
| 6 |
+
model_path = "best.pt"
|
| 7 |
+
|
| 8 |
+
# Load the YOLOv8 model
|
| 9 |
+
model = YOLO(model_path)
|
| 10 |
+
|
| 11 |
+
# Define the object detection function
|
| 12 |
+
def detect_objects(image):
|
| 13 |
+
results = model(image)
|
| 14 |
+
return results[0].plot()
|
| 15 |
+
|
| 16 |
+
# Create a Gradio interface
|
| 17 |
+
app = gr.Interface(fn=detect_objects, inputs="image", outputs="image")
|
| 18 |
+
|
| 19 |
+
# Launch Gradio app
|
| 20 |
+
app.launch()
|
best.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:41af358827b1c4bae6103877a678e0056ab4b2682ef7b012dfcbf269f9c67427
|
| 3 |
+
size 5486483
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
ultralytics
|
| 3 |
+
opencv-python
|
| 4 |
+
torch
|
| 5 |
+
torchvision
|