nishantguvvada commited on
Commit
31f7642
1 Parent(s): 18940a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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
- 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
 
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))