Update app.py

This commit is contained in:
augustin64 2022-04-20 20:57:04 +02:00
parent 54851be216
commit 29f694d04d

View File

@ -37,14 +37,15 @@ def recognize_mnist(image):
write_image_to_binary(image, ".cache/image.bin") write_image_to_binary(image, ".cache/image.bin")
try: try:
return {"status": 200, "data": output = subprocess.check_output([
json.loads(subprocess.check_output([ 'out/main',
'out/main', 'recognize',
'recognize', '--modele', '.cache/reseau.bin',
'--modele', '.cache/reseau.bin', '--in', '.cache/image.bin',
'--in', '.cache/image.bin', '--out', 'json'
'--out', 'json' ]).decode("utf-8")
]))["0"]} json_data = json.loads(output.replace("nan", "0.0"))["0"]
return {"status": 200, "data": json_data}
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
return { return {
"status": 500, "status": 500,