Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -348,8 +348,8 @@ def generate_caption(image):
|
|
| 348 |
# Read the image from the disk
|
| 349 |
sample_img = decode_and_resize(sample_img)
|
| 350 |
img = sample_img.numpy().clip(0, 255).astype(np.uint8)
|
| 351 |
-
plt.imshow(img)
|
| 352 |
-
plt.show()
|
| 353 |
|
| 354 |
# Pass the image to the CNN
|
| 355 |
img = tf.expand_dims(sample_img, 0)
|
|
@@ -374,7 +374,7 @@ def generate_caption(image):
|
|
| 374 |
|
| 375 |
decoded_caption = decoded_caption.replace("<start> ", "")
|
| 376 |
decoded_caption = decoded_caption.replace(" <end>", "").strip()
|
| 377 |
-
print(
|
| 378 |
|
| 379 |
inputs = [
|
| 380 |
gr.inputs.Image( label="Original Image")
|
|
@@ -385,7 +385,7 @@ outputs = [
|
|
| 385 |
]
|
| 386 |
|
| 387 |
title = "Image Captioning using CNN and a transformer + "
|
| 388 |
-
description = "Implementing an image
|
| 389 |
article = " "
|
| 390 |
examples = [["pic 1.jpg"], ["pic 2.jpg"], ["pic 3.jpg"], ["pic 4.jpg"]]
|
| 391 |
|
|
|
|
| 348 |
# Read the image from the disk
|
| 349 |
sample_img = decode_and_resize(sample_img)
|
| 350 |
img = sample_img.numpy().clip(0, 255).astype(np.uint8)
|
| 351 |
+
#plt.imshow(img)
|
| 352 |
+
#plt.show()
|
| 353 |
|
| 354 |
# Pass the image to the CNN
|
| 355 |
img = tf.expand_dims(sample_img, 0)
|
|
|
|
| 374 |
|
| 375 |
decoded_caption = decoded_caption.replace("<start> ", "")
|
| 376 |
decoded_caption = decoded_caption.replace(" <end>", "").strip()
|
| 377 |
+
print(decoded_caption)
|
| 378 |
|
| 379 |
inputs = [
|
| 380 |
gr.inputs.Image( label="Original Image")
|
|
|
|
| 385 |
]
|
| 386 |
|
| 387 |
title = "Image Captioning using CNN and a transformer + "
|
| 388 |
+
description = "Implementing an image captioning model using a pretrained CNN model of Efficient Net and transformer to generate Image Caption for the uploaded image. Flickr8K Dataset was used for training."
|
| 389 |
article = " "
|
| 390 |
examples = [["pic 1.jpg"], ["pic 2.jpg"], ["pic 3.jpg"], ["pic 4.jpg"]]
|
| 391 |
|