Skip to content
Snippets Groups Projects
Commit c2110a2d authored by merschie's avatar merschie
Browse files

refactoring

parent 2d55c3a5
Branches
No related tags found
No related merge requests found
...@@ -43,7 +43,7 @@ def base64_to_image(processed_image): ...@@ -43,7 +43,7 @@ def base64_to_image(processed_image):
@app.route('/predictNachname', methods=['POST']) @app.route('/predictName', methods=['POST'])
def predictNach(): def predictNach():
image_data=json.loads(request.data)['image'] image_data=json.loads(request.data)['image']
...@@ -69,31 +69,5 @@ def predictNach(): ...@@ -69,31 +69,5 @@ def predictNach():
return jsonify(result) return jsonify(result)
@app.route('/predictVorname', methods=['POST'])
def predictVor():
image_data=json.loads(request.data)['image']
image_array=base64_to_image(image_data)
preprocessor = htr_preprocessor.Preprocessor(htr.get_img_size(), dynamic_width=True, padding=16)
processed_image = preprocessor.process_img(image_array)
batch = htr_data_loader.Batch([processed_image], None, 1)
#change corpus for name
names=json.loads(request.data)['names']
model_name.corpus = names.split(' ')
recognized, probability = htr_model.Model.infer_batch(model_name, batch)
image_base64 = image_to_base64(processed_image)
result = {
'recognized': recognized,
'image': image_base64
}
return jsonify(result)
if __name__ == '__main__': if __name__ == '__main__':
app.run(debug=False,port=8000) app.run(debug=False,port=8000)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment