Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ model = BlipForConditionalGeneration.from_pretrained(model_id).to(device)
|
|
20 |
|
21 |
def run(image: PIL.Image.Image) -> str:
|
22 |
inputs = processor(images=image, return_tensors="pt").to(device)
|
23 |
-
out = model.generate(pixel_values=inputs.pixel_values, max_length=300)
|
24 |
generated_caption = processor.decode(out[0], skip_special_tokens=True)
|
25 |
return generated_caption
|
26 |
|
|
|
20 |
|
21 |
def run(image: PIL.Image.Image) -> str:
|
22 |
inputs = processor(images=image, return_tensors="pt").to(device)
|
23 |
+
out = model.generate(pixel_values=inputs.pixel_values, num_beams=3, max_length=300)
|
24 |
generated_caption = processor.decode(out[0], skip_special_tokens=True)
|
25 |
return generated_caption
|
26 |
|