Add support for passing arguments to the OCR backend.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-04-05 17:23:32 -04:00
parent 46b38b30d7
commit a0b7561ed7
4 changed files with 19 additions and 2 deletions

View File

@@ -136,6 +136,7 @@
- Update Chart.js version.
- Improve line chart appearance. Fix mouse hover label issue.
- Add JavaScript dependency manager.
- Add support for passing arguments to the OCR backend.
2.7.3 (2017-09-11)
==================

View File

@@ -426,6 +426,8 @@ Other changes worth mentioning
- Remove the data filters feature.
- Update Chart.js version.
- Improve line chart appearance. Fix issue with mouse over labels next other chart margin.
- Add support for passing arguments to the OCR backend.
Removals

View File

@@ -1,5 +1,15 @@
from __future__ import unicode_literals
import yaml
from django.utils.module_loading import import_string
from .settings import setting_ocr_backend
from .settings import setting_ocr_backend, setting_ocr_backend_arguments
ocr_backend = import_string(setting_ocr_backend.value)()
ocr_backend = import_string(
setting_ocr_backend.value
)(
**yaml.safe_load(
setting_ocr_backend_arguments.value or '{}'
)
)

View File

@@ -18,6 +18,10 @@ setting_ocr_backend = namespace.add_setting(
global_name='OCR_BACKEND', default='ocr.backends.pyocr.PyOCR',
help_text=_('Full path to the backend to be used to do OCR.')
)
setting_ocr_backend_arguments = namespace.add_setting(
global_name='OCR_BACKEND__ARGUMENTS',
default=''
)
setting_auto_ocr = namespace.add_setting(
global_name='OCR_AUTO_OCR', default=True,
help_text=_(