andgrt commited on
Commit
246c8f9
·
1 Parent(s): a6af9f6
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -20,9 +20,7 @@ image_processor = git_processor_base.image_processor
20
 
21
 
22
  def preprocess_image(image):
23
- """Преобразуем изображение для модели"""
24
- image_rgb = image.convert("RGB")
25
- return image_processor([image_rgb]).pixel_values
26
 
27
 
28
  def translate_ru2en(text):
@@ -45,7 +43,7 @@ def generate_answer_git(image, question):
45
  "document-question-answering",
46
  model="andgrt/layoutlmv2-base-uncased_finetuned_docvqa",
47
  )
48
- return qa_pipeline(image, question)[0]["answer"]
49
 
50
 
51
  def generate_answer(image, question):
 
20
 
21
 
22
  def preprocess_image(image):
23
+ return git_processor_base(images=image, return_tensors="pt").pixel_values
 
 
24
 
25
 
26
  def translate_ru2en(text):
 
43
  "document-question-answering",
44
  model="andgrt/layoutlmv2-base-uncased_finetuned_docvqa",
45
  )
46
+ return qa_pipeline(preprocess_image(image), question)[0]["answer"]
47
 
48
 
49
  def generate_answer(image, question):