Guspfc commited on
Commit
b2a3bf3
·
verified ·
1 Parent(s): f61ded6

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
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
- generated_ids = model.generate(
18
- pixel_values=pixel_values,
19
- max_length=500)
 
 
 
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):