Update app.py
Browse files
app.py
CHANGED
@@ -51,11 +51,14 @@ def process_image(image):
|
|
51 |
|
52 |
# Decode and post-process the generated text
|
53 |
generated_text = processor.batch_decode(
|
54 |
-
generated_ids,
|
|
|
55 |
)[0]
|
56 |
caption = processor.post_process_generation(
|
57 |
-
generated_text,
|
58 |
-
|
|
|
|
|
59 |
return caption
|
60 |
|
61 |
except Exception as e:
|
|
|
51 |
|
52 |
# Decode and post-process the generated text
|
53 |
generated_text = processor.batch_decode(
|
54 |
+
generated_ids,
|
55 |
+
skip_special_tokens=False
|
56 |
)[0]
|
57 |
caption = processor.post_process_generation(
|
58 |
+
generated_text,
|
59 |
+
task="<CAPTION>",
|
60 |
+
image_size=(image.width, image.height)
|
61 |
+
)
|
62 |
return caption
|
63 |
|
64 |
except Exception as e:
|