Zebra Translate
Web API
API Reference for the Zebra Web SDK (zebra-web).
Zebra
Class for the Zebra Translate engine.
Zebra.create()
Creates an instance of Zebra Translate engine using .pv file in public directory. Sets the source and target translation languages.
The model size is large, hence it will try to use the existing one if it exists, otherwise saves the model in storage.
Parameters
accessKeystring : AccessKey obtained from Picovoice Console.modelZebraModel : Object containing Zebra model data.
Returns
Zebra: An instance of the Zebra engine.
Zebra.translate()
Translates text. The maximum number of characters that can be translated at once
is given by .maxCharacterLimit.
Parameters
textstring : Text to translate.
Returns
string: Translated text.
Zebra.release()
Releases resources acquired by the Zebra Web SDK.
Zebra.version
Zebra version string.
Zebra.maxCharacterLimit
Maximum number of characters accepted by Zebra in one .translate() call.
Zebra.listAvailableDevices()
Lists all available devices that Zebra can use for inference. Each entry in the list can be the used as the device argument for the .create() method.
Returns
- string[] : List of all available devices that Zebra can use for inference.
ZebraModel
Zebra model type.
ZebraWorker
A class for creating new instances of ZebraWorker.
ZebraWorker.create()
Creates an instance of ZebraWorker using '.pv' file in public directory. The model size is large, hence it will try to use the existing one if it exists, otherwise saves the model in storage.
Parameters
accessKeystring : AccessKey obtained from Picovoice Console.modelZebraModel : Object containing Zebra model data. Sets the source and target translation languages.devicestring? : device String representation of the device (e.g., CPU or GPU) to use. If set tobest, the most suitable device is selected automatically. If set togpu, the engine uses the first available GPU device. To select a specific GPU device, set this argument togpu:${GPU_INDEX}, where${GPU_INDEX}is the index of the target GPU. If set tocpu, the engine will run on the CPU with the default number of threads. To specify the number of threads, set this argument tocpu:${NUM_THREADS}, where${NUM_THREADS}is the desired number of threads.
Returns
ZebraWorker: An instance ofZebraWorker.
ZebraWorker.translate()
Translates text. The maximum number of characters that can be translated at once
is given by .maxCharacterLimit.
Parameters
textstring : Text to translate.
Returns
string: Translated text.
ZebraWorker.release()
Releases resources acquired by the Zebra Web SDK.
ZebraWorker.terminate()
Force terminates the instance of ZebraWorker.
ZebraWorker.version
Zebra version string.
ZebraWorker.maxCharacterLimit
Maximum number of characters accepted by Zebra in one .translate() call.