Commit d3d878ac authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

Merge branch 'annotator' into 'master'

Load annotators as resources in FailSafe annotator

See merge request !142
parents 9e1b68db d99ffd97
Pipeline #18449 passed with stages
in 49 minutes and 19 seconds
import logging
import six
from . import Annotator
from .. import load_resource
logger = logging.getLogger(__name__)
......@@ -21,7 +23,11 @@ class FailSafe(Annotator):
def __init__(self, annotators, required_keys, **kwargs):
super(FailSafe, self).__init__(**kwargs)
self.annotators = list(annotators)
self.annotators = []
for annotator in annotators:
if isinstance(annotator, six.string_types):
annotator = load_resource(annotator, 'annotator')
self.annotators.append(annotator)
self.required_keys = list(required_keys)
def annotate(self, sample, **kwargs):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment