Spaces:
Runtime error
Runtime error
Files
Browse files
app.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
from PIL import Image
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
# Load the YOLOv8 model
|
| 7 |
+
from ultralytics import YOLO
|
| 8 |
+
model = YOLO("C:/Users/rater/Downloads/best.pt")
|
| 9 |
+
|
| 10 |
+
# Define a function for inference
|
| 11 |
+
def detect_objects(input_image):
|
| 12 |
+
# Convert Gradio input to a PIL image
|
| 13 |
+
|
| 14 |
+
# Perform object detection
|
| 15 |
+
results = model(input_image)
|
| 16 |
+
for r in results:
|
| 17 |
+
im_array = r.plot() # plot a BGR numpy array of predictions
|
| 18 |
+
im = Image.fromarray(im_array[..., ::-1])
|
| 19 |
+
return im
|
| 20 |
+
# Define the Gradio interface
|
| 21 |
+
outputs = gr.outputs.Image(type="pil", label="Output Image")
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
demo = gr.Interface(
|
| 25 |
+
detect_objects,
|
| 26 |
+
gr.Image(type="pil"),
|
| 27 |
+
outputs,
|
| 28 |
+
title="Burn Detection"
|
| 29 |
+
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
demo.launch()
|
| 33 |
+
|
best.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:92f3228865a1cd2cb50b65fd6aaf2efb0f95df7758f0361a2edb6c319f7ccf5c
|
| 3 |
+
size 6236142
|