Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import numpy as np
|
|
| 4 |
import pickle
|
| 5 |
from io import BytesIO
|
| 6 |
import math
|
|
|
|
| 7 |
|
| 8 |
app = FastAPI()
|
| 9 |
|
|
@@ -56,7 +57,9 @@ def get_fingerprint_type(winner):
|
|
| 56 |
async def predict_fingerprint_api(file: UploadFile = File(...)):
|
| 57 |
try:
|
| 58 |
contents = await file.read()
|
| 59 |
-
|
|
|
|
|
|
|
| 60 |
fingerprint_type = predict_fingerprint(image)
|
| 61 |
return {"prediction": fingerprint_type}
|
| 62 |
except Exception as e:
|
|
|
|
| 4 |
import pickle
|
| 5 |
from io import BytesIO
|
| 6 |
import math
|
| 7 |
+
import base64
|
| 8 |
|
| 9 |
app = FastAPI()
|
| 10 |
|
|
|
|
| 57 |
async def predict_fingerprint_api(file: UploadFile = File(...)):
|
| 58 |
try:
|
| 59 |
contents = await file.read()
|
| 60 |
+
print(f"contents:\n{contents}")
|
| 61 |
+
image = Image.open(BytesIO(base64.decodebytes(bytes(base64_str, "utf-8"))))
|
| 62 |
+
print(f"image:\n{image}")
|
| 63 |
fingerprint_type = predict_fingerprint(image)
|
| 64 |
return {"prediction": fingerprint_type}
|
| 65 |
except Exception as e:
|