sovitrath commited on
Commit
ab202ed
1 Parent(s): 119e43c
Files changed (4) hide show
  1. .gitignore +2 -0
  2. app.py +32 -4
  3. pothole_screenshot.png +0 -0
  4. requirements.txt +47 -0
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ flagged/
2
+ *.pt
app.py CHANGED
@@ -1,7 +1,35 @@
1
  import gradio as gr
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="image", outputs="image")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from gradio.outputs import Label
3
+ import cv2
4
 
5
+ from ultralytics import YOLO
 
6
 
7
+ model = YOLO('best.pt')
8
+ path = [['pothole_screenshot.png']]
9
+
10
+ def show_preds(image_path):
11
+ image = cv2.imread(image_path)
12
+ outputs = model.predict(source=image_path, return_outputs=True)
13
+ for image_id, result in enumerate(outputs):
14
+ print(result['det'])
15
+ for i, det in enumerate(result['det']):
16
+ print(det)
17
+ cv2.rectangle(
18
+ image,
19
+ (int(det[0]), int(det[1])),
20
+ (int(det[2]), int(det[3])),
21
+ color=(0, 0, 255),
22
+ thickness=2,
23
+ lineType=cv2.LINE_AA
24
+ )
25
+ return cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
26
+
27
+ gr_interface = gr.Interface(
28
+ fn=show_preds,
29
+ inputs=gr.inputs.Image(type="filepath", label="Input Image"),
30
+ outputs=gr.outputs.Image(type="numpy", label="Output Image"),
31
+ title="Pothole detector",
32
+ examples=path,
33
+ )
34
+
35
+ gr_interface.launch(inline=False, share=False, debug=True)
pothole_screenshot.png ADDED
requirements.txt ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Ultralytics requirements
2
+ # Usage: pip install -r requirements.txt
3
+
4
+ # Base ----------------------------------------
5
+ hydra-core>=1.2.0
6
+ matplotlib>=3.2.2
7
+ numpy>=1.18.5
8
+ opencv-python>=4.1.1
9
+ Pillow>=7.1.2
10
+ PyYAML>=5.3.1
11
+ requests>=2.23.0
12
+ scipy>=1.4.1
13
+ torch>=1.7.0
14
+ torchvision>=0.8.1
15
+ tqdm>=4.64.0
16
+ ultralytics
17
+
18
+ # Logging -------------------------------------
19
+ tensorboard>=2.4.1
20
+ # clearml
21
+ # comet
22
+
23
+ # Plotting ------------------------------------
24
+ pandas>=1.1.4
25
+ seaborn>=0.11.0
26
+
27
+ # Export --------------------------------------
28
+ # coremltools>=6.0 # CoreML export
29
+ # onnx>=1.12.0 # ONNX export
30
+ # onnx-simplifier>=0.4.1 # ONNX simplifier
31
+ # nvidia-pyindex # TensorRT export
32
+ # nvidia-tensorrt # TensorRT export
33
+ # scikit-learn==0.19.2 # CoreML quantization
34
+ # tensorflow>=2.4.1 # TF exports (-cpu, -aarch64, -macos)
35
+ # tensorflowjs>=3.9.0 # TF.js export
36
+ # openvino-dev # OpenVINO export
37
+
38
+ # Extras --------------------------------------
39
+ ipython # interactive notebook
40
+ psutil # system utilization
41
+ thop>=0.1.1 # FLOPs computation
42
+ # albumentations>=1.0.3
43
+ # pycocotools>=2.0.6 # COCO mAP
44
+ # roboflow
45
+
46
+ # HUB -----------------------------------------
47
+ GitPython>=3.1.24