codewithRiz commited on
Commit
89f033c
·
verified ·
1 Parent(s): ade3490

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -46
app.py DELETED
@@ -1,46 +0,0 @@
1
-
2
- from ultralytics import YOLO
3
- import gradio as gr
4
- import numpy as np
5
- from PIL import Image
6
-
7
- # -------------------------
8
- # Load detection model
9
- # -------------------------
10
- model = YOLO("buck_vs_doe_Detection_best.pt")
11
-
12
- # -------------------------
13
- # Inference function
14
- # -------------------------
15
- def predict(image):
16
- # Run inference (YOLO accepts numpy RGB directly)
17
- results = model(image)
18
-
19
- # Take first result (single image)
20
- r = results[0]
21
-
22
- # Plot results (BGR numpy array)
23
- im_bgr = r.plot()
24
-
25
- # Convert BGR → RGB for Gradio
26
- im_rgb = im_bgr[..., ::-1]
27
-
28
- return im_rgb
29
-
30
-
31
- # -------------------------
32
- # Gradio UI
33
- # -------------------------
34
- app = gr.Interface(
35
- fn=predict,
36
- inputs=gr.Image(type="numpy", label="Upload Image"),
37
- outputs=gr.Image(type="numpy", label="Detection Result"),
38
- title="Buck Tracker AI – Deer Detection",
39
- description="YOLO-based buck vs doe detection using Ultralytics native plotting."
40
- )
41
-
42
- # -------------------------
43
- # Launch
44
- # -------------------------
45
- if __name__ == "__main__":
46
- app.launch()