Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ def generate_caption(image):
|
|
12 |
|
13 |
# Preprocess the image and generate a detailed caption
|
14 |
inputs = processor(images=image, return_tensors="pt")
|
15 |
-
out = model.generate(**inputs, num_beams=5, max_length=
|
16 |
caption = processor.decode(out[0], skip_special_tokens=True)
|
17 |
|
18 |
end_time = time.time() # End time
|
|
|
12 |
|
13 |
# Preprocess the image and generate a detailed caption
|
14 |
inputs = processor(images=image, return_tensors="pt")
|
15 |
+
out = model.generate(**inputs, num_beams=5, max_length=500, early_stopping=True)
|
16 |
caption = processor.decode(out[0], skip_special_tokens=True)
|
17 |
|
18 |
end_time = time.time() # End time
|