sarim commited on
Commit
90ad422
·
1 Parent(s): 207fbf1

base64 change to image

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -5,10 +5,9 @@ import os
5
  # os.system('apt-get install tesseract-ocr -y')
6
  # os.system('pip install -q pytesseract')
7
 
8
- #from base64 import b64decode, b64encode
9
- #from io import BytesIO
10
- import base64
11
- import io
12
 
13
 
14
  import tesserocr
@@ -31,12 +30,13 @@ pipe = pipeline("document-question-answering", model="impira/layoutlm-document-q
31
 
32
 
33
  @app.post("/image")
34
- def read_root(imageBase64:str):
35
 
36
 
37
- img = Image.open(io.BytesIO(base64.decodebytes(bytes(imageBase64, "utf-8"))))
38
- print(img)
39
- image = img
 
40
 
41
  question_1 = "What is the Total amount?"
42
  question_2 = "What is Total VAT amount?"
 
5
  # os.system('apt-get install tesseract-ocr -y')
6
  # os.system('pip install -q pytesseract')
7
 
8
+ from base64 import b64decode, b64encode
9
+ from io import BytesIO
10
+
 
11
 
12
 
13
  import tesserocr
 
30
 
31
 
32
  @app.post("/image")
33
+ def read_root(image_file: bytes = File(...)):
34
 
35
 
36
+ #img = Image.open(io.BytesIO(base64.decodebytes(bytes(imageBase64, "utf-8"))))
37
+ #print(img)
38
+ #image = img
39
+ image = Image.open(BytesIO(image_file))
40
 
41
  question_1 = "What is the Total amount?"
42
  question_2 = "What is Total VAT amount?"