Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
@@ -14,9 +14,12 @@ def prepare_image(image_path):
|
|
14 |
def generate_caption(pixel_values):
|
15 |
model.eval()
|
16 |
with torch.no_grad():
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
20 |
return processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
21 |
|
22 |
def translate_to_portuguese(text):
|
|
|
14 |
def generate_caption(pixel_values):
|
15 |
model.eval()
|
16 |
with torch.no_grad():
|
17 |
+
generated_ids = model.generate(pixel_values=pixel_values, max_length=200,
|
18 |
+
do_sample=True,
|
19 |
+
top_k=120,
|
20 |
+
top_p=0.9,
|
21 |
+
early_stopping=True,
|
22 |
+
num_return_sequences=1)
|
23 |
return processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
24 |
|
25 |
def translate_to_portuguese(text):
|