Delete app.py
Browse files
app.py
DELETED
@@ -1,34 +0,0 @@
|
|
1 |
-
# -*- coding: utf-8 -*-
|
2 |
-
"""app.ipynb
|
3 |
-
|
4 |
-
Automatically generated by Colaboratory.
|
5 |
-
|
6 |
-
Original file is located at
|
7 |
-
https://colab.research.google.com/drive/1WeNkl1pYnT0qeOTsUFooLFLJ1arRHC00
|
8 |
-
"""
|
9 |
-
|
10 |
-
import gradio as gr
|
11 |
-
from ultralytics import YOLO
|
12 |
-
import cv2
|
13 |
-
import os
|
14 |
-
|
15 |
-
def predict_image(image_input):
|
16 |
-
image = cv2.imread(image_input)
|
17 |
-
# load model
|
18 |
-
model = YOLO("best.pt")
|
19 |
-
#run predict
|
20 |
-
outputs = model.predict(source=image_input)
|
21 |
-
results = outputs[0].cpu().numpy()
|
22 |
-
|
23 |
-
for i, det in enumerate(results.boxes.xyxy):
|
24 |
-
cv2.rectangle(image, (int(det[0]), int(det[1])), (int(det[2]), int(det[3])), color=(0, 0, 255), thickness=2, lineType=cv2.LINE_AA)
|
25 |
-
|
26 |
-
return cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
27 |
-
|
28 |
-
inputs_image = [gr.components.Image(type="filepath", label="Input Image")]
|
29 |
-
|
30 |
-
outputs_image = [gr.components.Image(type="numpy", label="Output Image")]
|
31 |
-
|
32 |
-
interface_image = gr.Interface(fn = predict_image, inputs=inputs_image, outputs=outputs_image,title="Fire & Smoke Detector", cache_examples=False)
|
33 |
-
|
34 |
-
interface_image.launch(debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|