server
This commit is contained in:
parent
9e990d1b81
commit
b852a340ca
8 changed files with 77 additions and 5 deletions
27
access_control_python_server/app.py
Normal file
27
access_control_python_server/app.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
from flask import Flask, request
|
||||
import json
|
||||
import cv2
|
||||
import base64
|
||||
import numpy as np
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def home():
|
||||
return '<h1>Ching Chong Bing Bong Ding Dong!!</h1>'
|
||||
|
||||
|
||||
@app.route('/process_image', methods=['POST'])
|
||||
def process_image():
|
||||
print(request.data)
|
||||
request_data = json.loads(request.data.decode("utf-8"))
|
||||
img_nparr = np.frombuffer(base64.b64decode(request_data['image']), np.uint8)
|
||||
img = cv2.imdecode(img_nparr,cv2.IMREAD_COLOR)
|
||||
cv2.imwrite("retrieved_img.jpg",img)
|
||||
print(request_data)
|
||||
return "Bing Bong!"
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run()
|
3
access_control_python_server/requirements.txt
Normal file
3
access_control_python_server/requirements.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
flask
|
||||
opencv-python
|
||||
deepface
|
25
access_control_python_server/unit.json
Normal file
25
access_control_python_server/unit.json
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"listeners": {
|
||||
"*:80": {
|
||||
"pass": "routes"
|
||||
}
|
||||
},
|
||||
"routes": [{
|
||||
"match": {
|
||||
"uri": "*"
|
||||
},
|
||||
"action": {
|
||||
"pass": "applications/racist_application"
|
||||
}
|
||||
}],
|
||||
"applications": {
|
||||
"racist_application": {
|
||||
"type": "python",
|
||||
"processes": 10,
|
||||
"working_directory": "/www/store/cart/",
|
||||
"path": "/www/store/",
|
||||
"home": ".virtualenv/",
|
||||
"module": "cart.run"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue