Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- app.py +23 -0
- best.pt +3 -0
- requirements.txt +4 -0
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from ultralytics import YOLO
|
| 3 |
+
|
| 4 |
+
# Load the YOLO model
|
| 5 |
+
model = YOLO('best.pt')
|
| 6 |
+
|
| 7 |
+
def predict(img):
|
| 8 |
+
|
| 9 |
+
results = model(img)
|
| 10 |
+
annotated_frame = results[0].plot()
|
| 11 |
+
return annotated_frame
|
| 12 |
+
|
| 13 |
+
# Create the Gradio interface
|
| 14 |
+
iface = gr.Interface(
|
| 15 |
+
fn=predict,
|
| 16 |
+
inputs=gr.Image(label="Input Image", type="filepath"),
|
| 17 |
+
outputs="image",
|
| 18 |
+
title="Rat Paw Detector",
|
| 19 |
+
description="Upload an image to detect rat paws"
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
# Launch the Gradio interface
|
| 23 |
+
iface.launch(share=True)
|
best.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:016663c7243bbaf34fe923ddec534fb32bf558efa7b326f6a3b9adcb581de29c
|
| 3 |
+
size 6209625
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
ultralytics
|
| 2 |
+
gradio
|
| 3 |
+
numpy
|
| 4 |
+
pillow
|