Waqas0327 commited on
Commit
7d2737d
·
verified ·
1 Parent(s): e78d9a4

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -31
app.py DELETED
@@ -1,31 +0,0 @@
1
- import gradio as gr
2
- from ultralytics import YOLO
3
- from PIL import Image
4
- import numpy as np
5
-
6
- # Load YOLOv8 model (Nano version for speed)
7
- model = YOLO("yolov8n.pt")
8
-
9
- # Object detection function
10
- def detect_objects(image):
11
- if image is None:
12
- return None
13
- if isinstance(image, np.ndarray):
14
- image = Image.fromarray(image)
15
- results = model.predict(image)
16
- result_image = results[0].plot()
17
- return Image.fromarray(result_image)
18
-
19
- # Gradio interface
20
- with gr.Blocks() as demo:
21
- gr.Markdown("## 🎯 Real-Time Object Detection (YOLOv8)")
22
-
23
- image_input = gr.Image(label="📷 Upload or Capture Image", tool="editor", type="numpy")
24
- result_output = gr.Image(label="🧠 Detected Output", type="pil")
25
-
26
- detect_button = gr.Button("🚀 Detect Objects")
27
-
28
- detect_button.click(fn=detect_objects, inputs=image_input, outputs=result_output)
29
-
30
- demo.launch()
31
-