VinitT commited on
Commit
b63e96a
1 Parent(s): 1eaa49d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -45,7 +45,7 @@ def generate_description(processor, model, device, image, user_question):
45
  text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
46
  inputs = processor(text=[text], images=[image], padding=True, return_tensors="pt")
47
  inputs = inputs.to(device)
48
- generated_ids = model.generate(**inputs, max_new_tokens=1024)
49
  generated_ids_trimmed = [out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)]
50
  output_text = processor.batch_decode(generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False)
51
  return output_text[0]
 
45
  text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
46
  inputs = processor(text=[text], images=[image], padding=True, return_tensors="pt")
47
  inputs = inputs.to(device)
48
+ generated_ids = model.generate(**inputs, max_new_tokens=512)
49
  generated_ids_trimmed = [out_ids[len(in_ids):] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)]
50
  output_text = processor.batch_decode(generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False)
51
  return output_text[0]