Update app.py

This commit is contained in:
Siwat Sirichai 2023-09-23 02:08:10 +07:00
parent c2bca54fca
commit d067ba3ac8
1 changed files with 3 additions and 3 deletions

View File

@ -3,6 +3,7 @@ import json
import cv2 import cv2
import base64 import base64
import numpy as np import numpy as np
from deepface import DeepFace
app = Flask(__name__) app = Flask(__name__)
@ -18,9 +19,8 @@ def process_image():
request_data = json.loads(request.data.decode("utf-8")) request_data = json.loads(request.data.decode("utf-8"))
img_nparr = np.frombuffer(base64.b64decode(request_data['image']), np.uint8) img_nparr = np.frombuffer(base64.b64decode(request_data['image']), np.uint8)
img = cv2.imdecode(img_nparr,cv2.IMREAD_COLOR) img = cv2.imdecode(img_nparr,cv2.IMREAD_COLOR)
cv2.imwrite("retrieved_img.jpg",img) racist_detector = DeepFace.analyze(img)
print(request_data) return racist_detector
return "Bing Bong!"
if __name__ == '__main__': if __name__ == '__main__':