1

I'm making a face recognition python API by flask. I need a way to make all service pause when get a particular request. After finish that particular request resume all service.

My development environment: Python 3.5 Flask 1.02

I make two function, one recognize face ,another update face data. A list store all face data using by recognize face function. Send a request to change face data while recognizing face will cause an error and crash.

Therefore, I need a way to stop face recognition function when get update request , after finish update function resume all face recognition request.

app = Flask(__name__)

# face recognition
@app.route('/A', methods=['POST'])
def jobA():
    data = request.get_json()
    ###fuction of face recognition 
    result = recognition(data)
    return jsonify({"result": result})


# update face data
@app.route('/B', methods=['POST'])
def jobB():
    data = request.get_json()
    ###fuction of update face data
    result = update(data)
    return jsonify({"result": result})

if __name__ == '__main__':
    app.run(host='0.0.0.0', debug=False)

when doing update and recognize in same time will crash. there is the error messages : Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

asd70930
  • 19
  • 1

0 Answers0