pedrororo commited on
Commit
66d8127
1 Parent(s): a5603ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -33,7 +33,12 @@ def generate_caption(image):
33
  inputs = processor(images=image, return_tensors="pt").to(device)
34
 
35
  # Gerar legenda
36
- out = model.generate(**inputs)
 
 
 
 
 
37
  caption = processor.decode(out[0], skip_special_tokens=True)
38
 
39
  return caption
 
33
  inputs = processor(images=image, return_tensors="pt").to(device)
34
 
35
  # Gerar legenda
36
+ out = model.generate(
37
+ **inputs,
38
+ max_length=100, # Ajuste conforme necessário
39
+ num_beams=5,
40
+ no_repeat_ngram_size=2
41
+ )
42
  caption = processor.decode(out[0], skip_special_tokens=True)
43
 
44
  return caption