Skip to content
Snippets Groups Projects
Commit d99ffd97 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

Load annotators as resources in FailSafe annotator

parent 9e1b68db
Branches
Tags
1 merge request!142Load annotators as resources in FailSafe annotator
Pipeline #
import logging import logging
import six
from . import Annotator from . import Annotator
from .. import load_resource
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -21,7 +23,11 @@ class FailSafe(Annotator): ...@@ -21,7 +23,11 @@ class FailSafe(Annotator):
def __init__(self, annotators, required_keys, **kwargs): def __init__(self, annotators, required_keys, **kwargs):
super(FailSafe, self).__init__(**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) self.required_keys = list(required_keys)
def annotate(self, sample, **kwargs): def annotate(self, sample, **kwargs):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment