Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,25 +1,7 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
"""
|
| 9 |
-
|
| 10 |
-
import tensorflow as tf
|
| 11 |
-
from tensorflow.keras import Model
|
| 12 |
-
from tensorflow.keras.models import load_model
|
| 13 |
-
|
| 14 |
-
# Function to preprocess the image
|
| 15 |
-
def preprocess_image(filename, target_shape=(160, 160)):
|
| 16 |
-
image_string = tf.io.read_file(filename)
|
| 17 |
-
image = tf.image.decode_jpeg(image_string, channels=3)
|
| 18 |
-
image = tf.image.convert_image_dtype(image, tf.float32)
|
| 19 |
-
image = tf.image.resize(image, target_shape)
|
| 20 |
-
return image
|
| 21 |
-
|
| 22 |
-
print("Hello")
|
| 23 |
-
|
| 24 |
-
# Load the base FaceNet model
|
| 25 |
-
facenet_model = load_model('facenet_keras.h5', compile=False)
|
|
|
|
| 1 |
+
# example of loading the keras facenet model
|
| 2 |
+
from keras.models import load_model
|
| 3 |
+
# load the model
|
| 4 |
+
model = load_model('facenet_keras.h5')
|
| 5 |
+
# summarize input and output shape
|
| 6 |
+
print(model.inputs)
|
| 7 |
+
print(model.outputs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|