Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -42,7 +42,12 @@ def predict_caption(image):
|
|
42 |
if word == 'endseq':
|
43 |
break
|
44 |
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
def generate_caption(image):
|
48 |
print(image)
|
|
|
42 |
if word == 'endseq':
|
43 |
break
|
44 |
|
45 |
+
# Split the generated sequence to exclude the first and last words
|
46 |
+
final_caption = in_text.split()[1:-1]
|
47 |
+
# Join the words to form the final caption
|
48 |
+
final_caption = ' '.join(final_caption)
|
49 |
+
|
50 |
+
return final_caption
|
51 |
|
52 |
def generate_caption(image):
|
53 |
print(image)
|