Update app.py
Browse files
app.py
CHANGED
@@ -31,7 +31,7 @@ def run(image: Union[str, PIL.Image.Image]) -> str:
|
|
31 |
if isinstance(image, str):
|
32 |
image = Image.open(image)
|
33 |
inputs = processor(images=image, return_tensors="pt").to(device)
|
34 |
-
out = model.generate(pixel_values=inputs.pixel_values, num_beams=3, max_length=300)
|
35 |
generated_caption = processor.decode(out[0], skip_special_tokens=True)
|
36 |
return generated_caption
|
37 |
|
|
|
31 |
if isinstance(image, str):
|
32 |
image = Image.open(image)
|
33 |
inputs = processor(images=image, return_tensors="pt").to(device)
|
34 |
+
out = model.generate(pixel_values=inputs.pixel_values, num_beams=3, repitition_penalty=2.5, max_length=300)
|
35 |
generated_caption = processor.decode(out[0], skip_special_tokens=True)
|
36 |
return generated_caption
|
37 |
|