Fix: types array

pull/40/head
Alexandre Dulaunoy 2016-08-04 18:54:21 +02:00
parent f97c5d62d6
commit 27ddbd9b92
1 changed files with 3 additions and 5 deletions

View File

@ -1,10 +1,7 @@
import json
import base64
try:
import Image
except ImportError:
from PIL import Image
from PIL import Image
from pytesseract import image_to_string
from io import BytesIO
@ -27,10 +24,11 @@ def handler(q=False):
request = json.loads(q)
image = base64.b64decode(request["data"])
image_file = BytesIO(image)
image_file.seek(0)
ocrized = image_to_string(Image.open(image_file))
freetext = {}
freetext['values'] = ocrized
freetext['type'] = 'freetext'
freetext['types'] = ['freetext']
r['results'].append(freetext)
return r