Update CaptionGenerator.py
Browse files- CaptionGenerator.py +2 -1
CaptionGenerator.py
CHANGED
|
@@ -39,7 +39,8 @@ class CaptionGenerator:
|
|
| 39 |
:return: description - The description generated for the image.
|
| 40 |
"""
|
| 41 |
try:
|
| 42 |
-
|
|
|
|
| 43 |
generated_ids = model.generate(**inputs, max_length=100)
|
| 44 |
description = processor.batch_decode(generated_ids, skip_special_tokens=True)[0].strip()
|
| 45 |
return description
|
|
|
|
| 39 |
:return: description - The description generated for the image.
|
| 40 |
"""
|
| 41 |
try:
|
| 42 |
+
prompt = " "
|
| 43 |
+
inputs = processor(images=image, text=prompt, return_tensors="pt")
|
| 44 |
generated_ids = model.generate(**inputs, max_length=100)
|
| 45 |
description = processor.batch_decode(generated_ids, skip_special_tokens=True)[0].strip()
|
| 46 |
return description
|