mirror of
https://github.com/augustin64/projet-tipe
synced 2025-01-24 07:36:24 +01:00
Update app.py
This commit is contained in:
parent
54851be216
commit
29f694d04d
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user