-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
54 lines (41 loc) · 1.35 KB
/
app.py
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Using flask to make an api
# import necessary libraries and functions
from flask import Flask, jsonify, request, render_template
from face_detect import detect_faces
from gun_detect import detect_weapon
from flask_cors import CORS # Import the CORS module
app = Flask(__name__)
CORS(app, resources={r"/*": {"origins": "*"}})
# creating a Flask app
app = Flask(__name__)
@app.route('/', methods=['GET'])
def home():
return render_template('index.html')
@app.route('/functioning', methods=['GET', 'POST'])
def functioning():
if (request.method == 'GET'):
token = detect_weapon()
token1 = detect_faces()
severity = 0
severity = token + token1
count=0
while(count!=3):
pin=345467
count+=1
if(pin=="12345"):
if(count>1):
severity+=0
else:
print("Wrong PIN")
severity+=3
return render_template("function.html",data=severity,token=token,token1=token1, count=count*3)
#return jsonify({'Level': severity})
# @app.route('/pin', methods=['GET', 'POST'])
# def pincode():
# pin_val=345467
# if request.method == 'POST':
# pin = request.form.get('pin')
# if pin == pin_val:
# driver function
if __name__ == '__main__':
app.run(debug = True, port=8000)