RashiAgarwal commited on
Commit
f375838
1 Parent(s): fba5215

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -0
app.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Gradio app for YOLOv3
2
+
3
+ import numpy as np
4
+ import gradio as gr
5
+ from pytorch_grad_cam import GradCAM
6
+ from pytorch_grad_cam.utils.image import show_cam_on_image
7
+ from pytorch_grad_cam.utils.model_targets import ClassifierOutputTarget
8
+ from display import inference
9
+
10
+
11
+ gr.Interface(
12
+ inference,
13
+ inputs=[
14
+ gr.Image(label="Input Image"),
15
+ gr.Slider(0, 1, value=0.5, label="IOU Threshold"),
16
+ gr.Slider(0, 1, value=0.4, label="Threshold"),
17
+ gr.Checkbox(label="Show Grad Cam"),
18
+ gr.Slider(0, 1, value=0.5, label="Opacity of GradCAM"),
19
+ ],
20
+ outputs=gr.Gallery(rows=2, columns=1),
21
+ title = '''YoloV3 on PASCAL VOC Dataset From Scratch
22
+ Classes - aeroplane, bicycle, bird,
23
+ boat, bottle, bus, car, cat, chair,
24
+ cow, diningtable, dog,horse, motorbike,
25
+ person, pottedplant, sheep, sofa,train, tvmonitor
26
+ '''
27
+
28
+ ,examples=[
29
+ ["Examples/000001.jpg", 0.75, 0.75, True, 0.5],
30
+ ["Examples/000002.jpg", 0.75, 0.75, True, 0.5]
31
+ ["Examples/000003.jpg", 0.75, 0.75, True, 0.5]
32
+ ["Examples/000004.jpg", 0.75, 0.75, True, 0.5]
33
+ ["Examples/000005.jpg", 0.75, 0.75, True, 0.5]
34
+ ["Examples/000006.jpg", 0.75, 0.75, True, 0.5]
35
+ ["Examples/000007.jpg", 0.75, 0.75, True, 0.5]
36
+ ["Examples/000008.jpg", 0.75, 0.75, True, 0.5]
37
+ ["Examples/000009.jpg", 0.75, 0.75, True, 0.5]
38
+ ["Examples/000010.jpg", 0.75, 0.75, True, 0.5]
39
+ ]
40
+
41
+ ,
42
+ layout="horizontal"
43
+ ).launch(debug=True)