Wallace He commited on
Commit
d4cbb06
·
1 Parent(s): 800419a

Add application file

Browse files
Files changed (3) hide show
  1. app.py +21 -0
  2. best.pt +3 -0
  3. requirements.txt +31 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import torch
3
+
4
+ from PIL import Image
5
+
6
+ model = torch.hub.load('ultralytics/yolov5', 'custom', path='best.pt', force_reload=True)
7
+
8
+ def detect(image):
9
+ results = model(image)
10
+ results.render()
11
+ return Image.fromarray(results.imgs[0])
12
+
13
+
14
+ inputs = gr.inputs.Image(type='pil', label="Original Image")
15
+ outputs = gr.outputs.Image(type="pil", label="Output Image")
16
+
17
+ title = "Object detection from Infrared image using YOLOv5n"
18
+
19
+
20
+ gr.Interface(detect, inputs, outputs, title=title, theme="huggingface").launch(debug=True)
21
+
best.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8940b5b18fbda2e984f972f621c9e52c906a4b499533b13ee51f86f53c0d9838
3
+ size 175088335
requirements.txt ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # pip install -r requirements.txt
2
+
3
+ # base ----------------------------------------
4
+ matplotlib>=3.2.2
5
+ numpy>=1.18.5
6
+ opencv-python-headless
7
+ Pillow
8
+ PyYAML>=5.3.1
9
+ scipy>=1.4.1
10
+ torch>=1.7.0
11
+ torchvision>=0.8.1
12
+ tqdm>=4.41.0
13
+
14
+ # logging -------------------------------------
15
+ tensorboard>=2.4.1
16
+ # wandb
17
+
18
+ # plotting ------------------------------------
19
+ seaborn>=0.11.0
20
+ pandas
21
+
22
+ # export --------------------------------------
23
+ # coremltools>=4.1
24
+ # onnx>=1.9.0
25
+ # scikit-learn==0.19.2 # for coreml quantization
26
+
27
+ # extras --------------------------------------
28
+ # Cython # for pycocotools https://github.com/cocodataset/cocoapi/issues/172
29
+ # pycocotools>=2.0 # COCO mAP
30
+ # albumentations>=1.0.3
31
+ thop # FLOPs computation