Skip to content

Model Server API

Lee Dong Ho edited this page Jul 24, 2019 · 17 revisions

Using AlpacaClient

Installation

AlpacaTag:
  + alpaca_client:
      - __init__.py
      - setup.py
  - alpaca_server
  - annotation

The best way to install the client is via setup.py install. move into alpaca_client directory and enter the command:

python setup.py install

methods

Method Description
.encode() Encode a list of strings to a list of vectors
.encode_async() Asynchronous encode batches from a generator
.fetch() Fetch all encoded vectors from server and return them in a generator, use it with .encode_async() or .encode(blocking=False). Sending order is NOT preserved.
.fetch_all() Fetch all encoded vectors from server and return them in a list, use it with .encode_async() or .encode(blocking=False). Sending order is preserved.
.close() Gracefully close the connection between the client and the server
.status Get the client status in JSON format
.server_status Get the server status in JSON format
Clone this wiki locally