Spaces:
Sleeping
Sleeping
nishantguvvada
commited on
Commit
•
31f7642
1
Parent(s):
18940a0
Update app.py
Browse files
app.py
CHANGED
@@ -79,11 +79,11 @@ word_to_index = StringLookup(
|
|
79 |
def predict_caption(file):
|
80 |
filename = Image.open(file)
|
81 |
image = filename.convert('RGB')
|
|
|
82 |
gru_state = tf.zeros((1, ATTENTION_DIM))
|
83 |
-
|
84 |
-
|
85 |
-
img =
|
86 |
-
img = img / 255
|
87 |
|
88 |
encoder = load_encoder_model()
|
89 |
features = encoder(tf.expand_dims(img, axis=0))
|
|
|
79 |
def predict_caption(file):
|
80 |
filename = Image.open(file)
|
81 |
image = filename.convert('RGB')
|
82 |
+
image = np.array(image)
|
83 |
gru_state = tf.zeros((1, ATTENTION_DIM))
|
84 |
+
|
85 |
+
resize = tf.image.resize(image, (IMG_HEIGHT, IMG_WIDTH))
|
86 |
+
img = np.expand_dims(resize/255, 0)
|
|
|
87 |
|
88 |
encoder = load_encoder_model()
|
89 |
features = encoder(tf.expand_dims(img, axis=0))
|