forked from sightsdev/SIGHTSVision
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
35 lines (28 loc) · 1.15 KB
/
app.py
File metadata and controls
35 lines (28 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from flask import Flask, Response
from nbformat import read
import hazmat_sights_interface as hz
import argparse
import qr_read_rotate as qrr
ap = argparse.ArgumentParser()
ap.add_argument("-s", "--suppression", default="on", help="enable use of nonmax suppression")
ap.add_argument('-vs', '--videosource', default='r', help='-vs r for robot, -vs w for webcam.')
ap.add_argument('-ip', '--address', default='http://10.0.0.5/stream/1', help='ip address of the robot on the SART Control network')
ap.add_argument('-tr', '--threading', default='e', help='e/d to enable/disable threaded hazmat detection')
args = vars(ap.parse_args())
ip = args['address']
robot_camera = args['videosource'] == 'r'
suppression = args['suppression'] == "on"
enable_threading = args['threading'] == 'e'
app = Flask(__name__)
@app.route('/hazmat')
def hazmat():
return Response(hz.detectionFeed(
ip, robot_camera, suppression, enable_threading
), mimetype='multipart/x-mixed-replace; boundary=frame')
@app.route('/qrcodes')
def qrcodes():
return Response(qrr.detectionFeed(
robot_camera, ip
))
if __name__ == '__main__':
app.run(host='0.0.0.0', debug=False)