Spaces:
Sleeping
Sleeping
nishantguvvada
commited on
Commit
•
18940a0
1
Parent(s):
572aec8
Update app.py
Browse files
app.py
CHANGED
@@ -78,9 +78,10 @@ word_to_index = StringLookup(
|
|
78 |
## Probabilistic prediction using the trained model
|
79 |
def predict_caption(file):
|
80 |
filename = Image.open(file)
|
|
|
81 |
gru_state = tf.zeros((1, ATTENTION_DIM))
|
82 |
|
83 |
-
img = tf.image.decode_jpeg(
|
84 |
img = tf.image.resize(img, (IMG_HEIGHT, IMG_WIDTH))
|
85 |
img = img / 255
|
86 |
|
|
|
78 |
## Probabilistic prediction using the trained model
|
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 |
+
img = tf.image.decode_jpeg(np.array(image), channels=IMG_CHANNELS)
|
85 |
img = tf.image.resize(img, (IMG_HEIGHT, IMG_WIDTH))
|
86 |
img = img / 255
|
87 |
|