Delete app.py
Browse files
app.py
DELETED
@@ -1,59 +0,0 @@
|
|
1 |
-
null = ""
|
2 |
-
{
|
3 |
-
"cells": [
|
4 |
-
{
|
5 |
-
"cell_type": "code",
|
6 |
-
"execution_count": null,
|
7 |
-
"id": "81598ea8-8e97-4ad7-a45f-bd928d0ef416",
|
8 |
-
"metadata": {},
|
9 |
-
"outputs": [],
|
10 |
-
"source": [
|
11 |
-
"import gradio as gr\n",
|
12 |
-
"from ultralytics import YOLO\n",
|
13 |
-
"import cv2\n",
|
14 |
-
"import os\n",
|
15 |
-
"\n",
|
16 |
-
"def predict_image(image_input):\n",
|
17 |
-
" image = cv2.imread(image_input)\n",
|
18 |
-
" # load model\n",
|
19 |
-
" model = YOLO(\"best.pt\")\n",
|
20 |
-
" #run predict\n",
|
21 |
-
" outputs = model.predict(source=image_input)\n",
|
22 |
-
" results = output[0].cpu().numpy()\n",
|
23 |
-
" for i, det in enumerate(results.boxes.xyxy):\n",
|
24 |
-
" cv2.rectangle(image, (int(det[0]), int(det[1]), int(det[2]), int(det[3]),\n",
|
25 |
-
" color=(0, 0, 255), thickness=2, lineType=cv2.Line_AA)\n",
|
26 |
-
" return cv2.cvtColor(image, cv2.COLOR_BGR2RGB)\n",
|
27 |
-
"\n",
|
28 |
-
"inputs_image = [gr.components.Image(type=\"filepath\", label=\"Input Image\")]\n",
|
29 |
-
"outputs_image = [gr.components.Image(type=\"numpy\", label=\"Output Image\")]\n",
|
30 |
-
"\n",
|
31 |
-
"interface_image = gr.Interface(fn = predict_image, inputs=inputs_image, outputs=outputs_image, \n",
|
32 |
-
" title=\"Fire & Smoke Detector\", cache_examples=False)\n",
|
33 |
-
"\n",
|
34 |
-
"interface_image.launch(Debug=True)\n"
|
35 |
-
]
|
36 |
-
}
|
37 |
-
],
|
38 |
-
"metadata": {
|
39 |
-
"kernelspec": {
|
40 |
-
"display_name": "Python 3 (ipykernel)",
|
41 |
-
"language": "python",
|
42 |
-
"name": "python3"
|
43 |
-
},
|
44 |
-
"language_info": {
|
45 |
-
"codemirror_mode": {
|
46 |
-
"name": "ipython",
|
47 |
-
"version": 3
|
48 |
-
},
|
49 |
-
"file_extension": ".py",
|
50 |
-
"mimetype": "text/x-python",
|
51 |
-
"name": "python",
|
52 |
-
"nbconvert_exporter": "python",
|
53 |
-
"pygments_lexer": "ipython3",
|
54 |
-
"version": "3.9.18"
|
55 |
-
}
|
56 |
-
},
|
57 |
-
"nbformat": 4,
|
58 |
-
"nbformat_minor": 5
|
59 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|