Fix stuff
This commit is contained in:
10
owocr/ocr.py
10
owocr/ocr.py
@@ -136,7 +136,7 @@ class GoogleVision:
|
|||||||
|
|
||||||
def _preprocess(self, img):
|
def _preprocess(self, img):
|
||||||
image_bytes = io.BytesIO()
|
image_bytes = io.BytesIO()
|
||||||
img.save(image_bytes, format=img.format)
|
img.save(image_bytes, format='png')
|
||||||
return image_bytes.getvalue()
|
return image_bytes.getvalue()
|
||||||
|
|
||||||
class GoogleLens:
|
class GoogleLens:
|
||||||
@@ -248,7 +248,7 @@ class AppleVision:
|
|||||||
|
|
||||||
def _preprocess(self, img):
|
def _preprocess(self, img):
|
||||||
image_bytes = io.BytesIO()
|
image_bytes = io.BytesIO()
|
||||||
img.save(image_bytes, format=img.format)
|
img.save(image_bytes, format='png')
|
||||||
return image_bytes.getvalue()
|
return image_bytes.getvalue()
|
||||||
|
|
||||||
class WinRTOCR:
|
class WinRTOCR:
|
||||||
@@ -301,7 +301,7 @@ class WinRTOCR:
|
|||||||
|
|
||||||
def _preprocess(self, img):
|
def _preprocess(self, img):
|
||||||
image_bytes = io.BytesIO()
|
image_bytes = io.BytesIO()
|
||||||
img.save(image_bytes, format=img.format)
|
img.save(image_bytes, format='png')
|
||||||
return image_bytes.getvalue()
|
return image_bytes.getvalue()
|
||||||
|
|
||||||
class AzureComputerVision:
|
class AzureComputerVision:
|
||||||
@@ -353,7 +353,7 @@ class AzureComputerVision:
|
|||||||
|
|
||||||
def _preprocess(self, img):
|
def _preprocess(self, img):
|
||||||
image_io = io.BytesIO()
|
image_io = io.BytesIO()
|
||||||
img.save(image_io, format=img.format)
|
img.save(image_io, format='png')
|
||||||
image_io.seek(0)
|
image_io.seek(0)
|
||||||
return image_io
|
return image_io
|
||||||
|
|
||||||
@@ -390,7 +390,7 @@ class EasyOCR:
|
|||||||
|
|
||||||
def _preprocess(self, img):
|
def _preprocess(self, img):
|
||||||
image_bytes = io.BytesIO()
|
image_bytes = io.BytesIO()
|
||||||
img.save(image_bytes, format=img.format)
|
img.save(image_bytes, format='png')
|
||||||
return image_bytes.getvalue()
|
return image_bytes.getvalue()
|
||||||
|
|
||||||
class PaddleOCR:
|
class PaddleOCR:
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ def user_input_thread_run(engine_instances, engine_keys, engine_color):
|
|||||||
engine_index = 0
|
engine_index = 0
|
||||||
else:
|
else:
|
||||||
engine_index += 1
|
engine_index += 1
|
||||||
elif user_input.lower() in engine_keys:
|
elif user_input.lower() != '' and user_input.lower() in engine_keys:
|
||||||
engine_index = engine_keys.index(user_input.lower())
|
engine_index = engine_keys.index(user_input.lower())
|
||||||
|
|
||||||
if engine_index != old_engine_index:
|
if engine_index != old_engine_index:
|
||||||
|
|||||||
Reference in New Issue
Block a user