jina.helloworld.fashion.my_executors module
class jina.helloworld.fashion.my_executors.MyIndexer(\*kwargs*)[source]
Bases: jina.serve.executors.BaseExecutor
Executor with basic exact search using cosine distance
metas and requests are always auto-filled with values from YAML config.
Parameters
metas – a dict of metas fields
requests – a dict of endpoint-function mapping
runtime_args – a dict of arguments injected from
Runtime
during runtimekwargs – additional extra keyword arguments to avoid failing when extra params ara passed that are not expected
index(docs, \*kwargs*)[source]
Extend self._docs
Parameters
docs (DocumentArray) – DocumentArray containing Documents
kwargs – other keyword arguments
search(docs, parameters, \*kwargs*)[source]
Append best matches to each document in docs
Parameters
docs (DocumentArray) – documents that are searched
parameters (
Dict
) – dictionary of pairs (parameter,value)kwargs – other keyword arguments
close()[source]
Stores the DocumentArray to disk
requests = {‘/eval’: <function MyIndexer.search>, ‘/index’: <function MyIndexer.index>, ‘/search’: <function MyIndexer.search>}
class jina.helloworld.fashion.my_executors.MyEncoder(\*kwargs*)[source]
Bases: jina.serve.executors.BaseExecutor
Encode data using SVD decomposition
metas and requests are always auto-filled with values from YAML config.
Parameters
metas – a dict of metas fields
requests – a dict of endpoint-function mapping
runtime_args – a dict of arguments injected from
Runtime
during runtimekwargs – additional extra keyword arguments to avoid failing when extra params ara passed that are not expected
encode(docs, \*kwargs*)[source]
Encode the data using an SVD decomposition
Parameters
docs (DocumentArray) – input documents to update with an embedding
kwargs – other keyword arguments
- requests = {‘/default’: <function MyEncoder.encode>}
class jina.helloworld.fashion.my_executors.MyConverter(metas=None, requests=None, runtime_args=None, \*kwargs*)[source]
Bases: jina.serve.executors.BaseExecutor
Convert DocumentArrays removing tensor and reshaping tensor as image
metas and requests are always auto-filled with values from YAML config.
Parameters
metas (
Optional
[Dict
]) – a dict of metas fieldsrequests (
Optional
[Dict
]) – a dict of endpoint-function mappingruntime_args (
Optional
[Dict
]) – a dict of arguments injected fromRuntime
during runtimekwargs – additional extra keyword arguments to avoid failing when extra params ara passed that are not expected
convert(docs, \*kwargs*)[source]
Remove tensor and reshape documents as squared images :type docs: DocumentArray :param docs: documents to modify :param kwargs: other keyword arguments
requests = {‘/default’: <function MyConverter.convert>}