Update app.py
Browse files
app.py
CHANGED
|
@@ -40,7 +40,7 @@ def generate_caption_and_image(image):
|
|
| 40 |
|
| 41 |
|
| 42 |
# Generate caption
|
| 43 |
-
inputs = processor(
|
| 44 |
inputs = {key: val.to(device) for key, val in inputs.items()}
|
| 45 |
out = model.generate(**inputs)
|
| 46 |
caption = processor.decode(out[0], skip_special_tokens=True)
|
|
|
|
| 40 |
|
| 41 |
|
| 42 |
# Generate caption
|
| 43 |
+
inputs = processor(image, return_tensors="pt", padding=True, truncation=True, max_length=250)
|
| 44 |
inputs = {key: val.to(device) for key, val in inputs.items()}
|
| 45 |
out = model.generate(**inputs)
|
| 46 |
caption = processor.decode(out[0], skip_special_tokens=True)
|