Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ import numpy as np
|
|
| 3 |
import tensorflow as tf
|
| 4 |
from tensorflow import keras
|
| 5 |
from model import build_siamese
|
|
|
|
| 6 |
import os
|
| 7 |
|
| 8 |
# Suppress oneDNN warnings (optional)
|
|
@@ -59,7 +60,8 @@ stored_imgs = load_stored_images()
|
|
| 59 |
# Inference function
|
| 60 |
def check_membership(uploaded_image):
|
| 61 |
try:
|
| 62 |
-
image =
|
|
|
|
| 63 |
uploaded_image = np.expand_dims(image, axis=0).astype("float32")
|
| 64 |
|
| 65 |
predictions = [siamese.predict([uploaded_image, img])[0][0] for img in stored_imgs]
|
|
|
|
| 3 |
import tensorflow as tf
|
| 4 |
from tensorflow import keras
|
| 5 |
from model import build_siamese
|
| 6 |
+
import cv2
|
| 7 |
import os
|
| 8 |
|
| 9 |
# Suppress oneDNN warnings (optional)
|
|
|
|
| 60 |
# Inference function
|
| 61 |
def check_membership(uploaded_image):
|
| 62 |
try:
|
| 63 |
+
image = cv2.resize(uploaded_image, (256, 256))
|
| 64 |
+
|
| 65 |
uploaded_image = np.expand_dims(image, axis=0).astype("float32")
|
| 66 |
|
| 67 |
predictions = [siamese.predict([uploaded_image, img])[0][0] for img in stored_imgs]
|