olivepy.api package¶
Submodules¶
olivepy.api.olive_async_client module¶
- class olivepy.api.olive_async_client.AsyncOliveClient(client_id, address='localhost', request_port=5588, timeout_second=10)¶
Bases:
threading.Thread
This class is used to make asynchronous requests to the OLIVE server
- connect(monitor_status=False)¶
Connect this client to the server
- Parameters
monitor_server – if true, starts a thread to monitor the server status connection for heartbeat messages
- add_heartbeat_listener(heartbeat_callback)¶
Register a callback function to be notified when a heartbeat is received from the OLIVE server
- Parameters
heartbeat_callback (
Callable
[[Heartbeat
],None
]) – The callback method that is notified each time a heartbeat message is received from the OLIVE server
- clear_heartbeat_listeners()¶
Remove all heartbeat listeners
- enqueue_request(message, callback, wrapper=None)¶
Add a message request to the outbound queue
- Parameters
message – the request message to send
callback – this is called when response message is received from the server
wrapper – the message wrapper
- sync_request(message, wrapper=None)¶
Send a request to the OLIVE server, but wait for a response from the server
- Parameters
message – the request message to send to the OLIVE server
- Returns
the response from the server
- run()¶
Starts the thread to handle async messages
- disconnect()¶
Closes the connection to the OLIVE server
- is_connected()¶
Status of the connection to the OLIVE server
- Returns
True if connected
- classmethod setup_multithreading()¶
This function is only needed for multithreaded programs. For those programs, you must call this function from the main thread, so it can properly set up your signals so that control-C will work properly to exit your program.
- request_plugins(callback=None)¶
Used to make a PluginDirectoryRequest
- Parameters
callback (
Optional
[Callable
[[OliveServerResponse
],None
]]) – optional method called when the OLIVE server returns a response to this request. If a callback is not provided, this call blocks until a response is received from the OLIVE server. The callback method accepts one argument: OliveServerResponse- Returns
a OliveServerResponse containing information about available plugin/domains (PluginDirectoryResult)
- get_update_status(plugin, domain, callback=None)¶
Used to make a GetUpdateStatusRequest
- Parameters
plugin – the name of the plugin to query
domain – the name of the domain to query
callback (
Optional
[Callable
[[OliveServerResponse
],None
]]) – optional method called when the OLIVE server returns a response to this request. If a callback is not provided, this call blocks until a response is received from the OLIVE server. The callback method accepts one argument: OliveServerResponse
- Returns
a OliveServerResponse containing the update status of the requested plugin/domain (GetUpdateStatusResult
- load_plugin_domain(plugin, domain, callback)¶
Used to make a request to pre-load a plugin/domain (via a LoadPluginDomainRequest message)
- Parameters
plugin – the name of the plugin to pre-load
domain – the name of hte domain to pre-load
callback (
Callable
[[OliveServerResponse
],None
]) – optional method called when the OLIVE server returns a response to this request. If a callback is not provided, this call blocks until a response is received from the OLIVE server. The callback method accepts one argument: OliveServerResponse
- Returns
a OliveServerResponse containing the update status of the request (LoadPluginDomainResult)
- unload_plugin_domain(plugin, domain, callback)¶
Used to make a unload plugin/domain request (RemovePluginDomainRequest). This request will un-load a loaded plugin from server memory)
- Parameters
plugin – the name of the plugin to unload
domain – the name of hte domain to unload
callback (
Callable
[[OliveServerResponse
],None
]) – optional method called when the OLIVE server returns a response to this request. If a callback is not provided, this call blocks until a response is received from the OLIVE server. The callback method accepts one argument: OliveServerResponse
- Returns
a OliveServerResponse containing the status of the request (RemovePluginDomainResult)
- update_plugin_domain(plugin, domain, metadata, callback)¶
Used to make a ApplyUpdateRequest
- Parameters
plugin – the name of the plugin to update
domain – the name of hte domain to update
callback (
Callable
[[OliveServerResponse
],None
]) – optional method called when the OLIVE server returns a response to this request. If a callback is not provided, this call blocks until a response is received from the OLIVE server. The callback method accepts one argument: OliveServerResponse
- Returns
a OliveServerResponse containing the status of the request (ApplyUpdateResult)
- get_active(callback)¶
Used to make a GetActiveRequest
- Parameters
callback (
Callable
[[OliveServerResponse
],None
]) – optional method called when the OLIVE server returns a response to this request. If a callback is not provided, this call blocks until a response is received from the OLIVE server. The callback method accepts one argument: OliveServerResponse- Returns
a OliveServerResponse containing the status of the request (GetActiveResult)
- get_status(callback=None)¶
Used to make a GetStatusRequest and receive a GetStatusResult
- Parameters
callback (
Optional
[Callable
[[OliveServerResponse
],None
]]) – optional method called when the OLIVE server returns a response to the request. If a callback is not provided, this call blocks until a response is received from the OLIVE server. The callback method accepts one argument: OliveServerResponse- Returns
a OliveServerResponse that contains the most recent server status (GetStatusResult)
- analyze_frames(plugin, domain, audio_input, callback, mode=AudioTransferType.AUDIO_SERIALIZED, opts=None)¶
Request a analysis of ‘filename’, returning frame scores.
- Parameters
plugin – the name of the plugin
domain – the name of the plugin domain
audio_input – the audio to score
callback (
Callable
[[OliveServerResponse
],None
]) – optional method called when the OLIVE server returns a response to this request. If a callback is not provided, this call blocks until a response is received from the OLIVE server. The callback method accepts one argument: OliveServerResponsemode – the audio transfer mode
opts – a dictionary of name/value pair options for this plugin request
- Returns
a OliveServerResponse containing the status of the request (FrameScorerResult)
- analyze_regions(plugin, domain, filename, callback, mode=AudioTransferType.AUDIO_SERIALIZED)¶
Request a analysis of ‘filename’, returning regions
- Parameters
plugin – the name of the plugin
domain – the name of the plugin domain
filename – the name of the audio file to score
callback (
Callable
[[OliveServerResponse
],None
]) – optional method called when the OLIVE server returns a response to the request. If a callback is not provided, this call blocks until a response is received from the OLIVE server. The callback method accepts one argument: OliveServerResponsemode – the audio transfer mode
- Returns
a OliveServerResponse containing the status of the request (RegionScorerResult)
- analyze_global(plugin, domain, audio_input, callback, mode=AudioTransferType.AUDIO_SERIALIZED)¶
Request a global score analysis of ‘filename’
- Parameters
plugin – the name of the plugin
domain – the name of the plugin domain
audio_input – the name of the audio file to score
callback (
Callable
[[OliveServerResponse
],None
]) – optional method called when the OLIVE server returns a response to the request. If a callback is not provided, this call blocks until a response is received from the OLIVE server. The callback method accepts one argument: OliveServerResponsemode – the audio transfer mode
- Returns
a OliveServerResponse containing the status of the request (GlobalScorerResult)
- enroll(plugin, domain, class_id, audio_input, callback, mode=AudioTransferType.AUDIO_SERIALIZED)¶
Request a enrollment of ‘audio’
- Parameters
plugin – the name of the plugin
domain – the name of the plugin domain
class_id – the name of the class (i.e. speaker) to enroll
audio_input – the Audio message to add as an enrollment addition
callback (
Callable
[[OliveServerResponse
],None
]) – optional method called when the OLIVE server returns a response to the request. If a callback is not provided, this call blocks until a response is received from the OLIVE server. The callback method accepts one argument: OliveServerResponsemode – the audio transfer mode
- Returns
a OliveServerResponse containing the status of the request (ClassModificationResult)
- unenroll(plugin, domain, class_id, callback)¶
Unenroll class_id
- Parameters
plugin – the name of the plugin
domain – the name of the plugin domain
class_id – the name of the class (i.e. speaker) to remove
callback (
Callable
[[OliveServerResponse
],None
]) – optional method called when the OLIVE server returns a response to the request. If a callback is not provided, this call blocks until a response is received from the OLIVE server. The callback method accepts one argument: OliveServerResponse
- Returns
a OliveServerResponse containing the status of the request (ClassRemovalResult)
- audio_modification(plugin, domain, audio_input, callback, mode=AudioTransferType.AUDIO_SERIALIZED)¶
Used to make a AudioModificationRequest (enhancement).
- Parameters
plugin – the name of the plugin
domain – the name of the plugin domain
audio_input – the audio path or buffer to submit for modification
callback (
Callable
[[OliveServerResponse
],None
]) – optional method called when the OLIVE server returns a response to the request. If a callback is not provided, this call blocks until a response is received from the OLIVE server. The callback method accepts one argument: OliveServerResponsemode – the audio transfer mode
- Returns
a OliveServerResponse containing the status of the request (AudioModificationResult)
- class olivepy.api.olive_async_client.ClientMonitorThread(status_socket, client_id)¶
Bases:
threading.Thread
Helper used to monitor the status of the Oliveserver
- stopWorker()¶
- add_event_callback(callback)¶
Callback function that is notified of a heartbeat
- Parameters
callback (
Callable
[[Heartbeat
],None
]) – the function that is called with a Heartbeat object
- clear_callbacks()¶
- run()¶
Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
olivepy.api.oliveclient module¶
- class olivepy.api.oliveclient.OliveClient(client_id, address='localhost', request_port=5588, timeout_second=10)¶
Bases:
object
This is a simplified version of network library used to contact the Olive server via python code. All OLIVE calls below are synchronous, and block and until a response is received from the OLIVE server. These example API calls are intended to make working with the OLIVE API clearer since all calls are blocking. To make asynchronous requests to the OLIVE server use olivepy.api.olive_async_client.AsyncOliveClient for your enterprise application.
- connect(monitor_server=False)¶
Connect this client to the server
- Parameters
monitor_server – if true, start a thread to monitor the server connection (helpful if debugging connection issues)
- disconnect()¶
- is_connected()¶
- classmethod setup_multithreading()¶
This function is only needed for multithreaded programs. For those programs, you must call this function from the main thread, so it can properly set up your signals so that control-C will work properly to exit your program.
- request_plugins()¶
- get_update_status(plugin, domain)¶
- load_plugin_domain(plugin, domain)¶
- unload_plugin_domain(plugin, domain)¶
- update_plugin_domain(plugin, domain, metadata)¶
- get_info()¶
- Returns
the info data from the last call to the server. Will return None if the last call did not return any info.
- get_fullobj()¶
- This object should be used for debugging only. Example use::success = client.enroll(‘sid-embed-v5-py3’, ‘multilang-v1’, ‘joshua’, ‘file’) if troubleshooting:
fullobj = client.get_fullobj() print(‘Whole object returned from server: ‘+str(fullobj))
- Returns
the full object returned from the last call to the server.
- get_active()¶
- get_status()¶
- analyze_frames(plugin, domain, filename, opts=None, classes=None, mode=AudioTransferType.AUDIO_PATH)¶
Request a analysis of ‘filename’ returning frame scores.
- Parameters
plugin – the name of the plugin
domain – the name of the plugin domain
filename – the name of the audio file to score
opts – a dictionary of name/value pair options
classes – optionally, a list of classes classes to be scored
- Returns
the analysis as a list of (frame) scores
- analyze_regions(plugin, domain, filename, mode=AudioTransferType.AUDIO_PATH, opts=None, classes=None)¶
Request a analysis of ‘filename’ returning regions
- Parameters
plugin – the name of the plugin
domain – the name of the plugin domain
filename – the name of the audio file to score
mode – the way audio is submitted to the server
opts – a dictionary of name/value pair options
classes – optionally, a list of classes classes to be scored
- Returns
a list of (start, end) regions in seconds, each region indicates a speech region found in the submitted file.
- enroll(plugin, domain, class_id, audio2)¶
Request a enrollment of ‘audio’
- Parameters
plugin – the name of the plugin
domain – the name of the plugin domain
class_id – the name of the class (speaker) to enroll
audio2 – the Audio message to add as an enrollment addition
- Returns
True if enrollment successful
- unenroll(plugin, domain, class_id)¶
Unenrollment the class_id
- Parameters
plugin – the name of the plugin
domain – the name of the plugin domain
class_id – the name of the class (speaker) to enroll
- Returns
True if enrollment successful
- apply_threshold(scores, threshold, rate)¶
Very simple method to convert frame scores to regions. If speech regions are desired we can provide a SAD plugin that returns regions instead of frame scores
- Parameters
scores –
threshold –
rate –
- Returns
frame scores a regions
- analyze_global(plugin, domain, filename, mode=AudioTransferType.AUDIO_PATH, opts=None, classes=None)¶
Request a LID analysis of ‘filename’
- Parameters
plugin – the name of the LID plugin
domain – the name of the plugin domain
filename – the name of the audio file to score
mode – the audio transfer mode
opts – a dictionary of name/value pair options
classes – optionally, a list of classes classes to be scored
- Returns
the analysis result as a list of (global) scores
- audio_modification(plugin, domain, filename, mode=AudioTransferType.AUDIO_PATH)¶
Do an audio modification (such as an enhansement). This function only accepts one audio and returns on modified audio. :param plugin: the name of the plugin :param domain: the name of the plugin domain :param filename: the name of the audio file to score
- Returns
the analysis as a list of (frame) scores
- requst_sad_adaptation()¶
Example of performing SAD adaptation :return:
- parse_annotation_file(filename)¶
Parse a file for the names of files of audio files and their regions to use for adaptation. :param filename: the path and name of the file that contains the input. This file must have one or more lines having 4 columns: # filename, class, start_region_ms, end_region_ms :return: the parsed output, in a dictionary indexed by the filename, each element having one or more regions, for example {test.wav: [(2618, 6200, ‘S’), (7200, 9500, ‘NS’)]}
- adapt_supervised(plugin, domain, annotations_file_name, new_domain_name)¶
- Parameters
plugin – the plugin for adaptation
domain – the domain for adaptation
adapt_workspace – a unique label for this client’s adaptation
annotations_file_name – the name of a file containing annotations. This file contains lines with four tokens: filename, start, end, and class. start and end are in milliseconds, but that should change to seconds.
- Returns
the full path name of the new domain.
- adapt_supervised_old(plugin, domain, file_annotations, new_domain_name)¶
- Parameters
plugin – the plugin for adaptation
domain – the domain for adaptation
adapt_workspace – a unique label for this client’s adaptation
file_annotations – a dictionary of files to preprocess, each file has one or more annotated regions for processing {filename: [(start_ms, end_ms, class)]}, for example {test.wav: [(2618, 6200, ‘S’), (7200, 9500, ‘NS’)]}
- Returns
the full path name of the new domain.
- preprocess_supervised_audio(plugin, domain, filename, adapt_workspace)¶
Submit audio for pre-processing phase of adaptation.
- Parameters
plugin – the name of the plugin to adapt
domain – the name of the plugin domain to adapt
filename – the name of the audio file to submit to the server/plugin/domain for preprocessing
- Returns
the unique id generated by the server for the preprocess audio, which must be used
- convert_preprocessed_annotations(processed_audio_list)¶
Convert the file annotations (a dictionary grouped by file ID, where annotations are grouped by file ID, which has one or more regions/classes) into class annotations (where annotations are grouped by class ID, with each class having one or more files, then each file having one or more regions). :param processed_audio_list: the list of files (indexed by an OLIVE generated ID) and the regions/classes annotated in that file :return: a dictionary of ClassAnnotation objects, indexed by class ID
- finalize_supervised_adaptation(plugin, domain, new_domain_name, class_annotations, adapt_workspace)¶
Complete the adaptation
- Parameters
plugin – the name of the plugin to adapt
domain – the name of the plugin domain to adapt
new_domain_name – the name of the new domain that is created within the plugin
class_annotations – the audio annotations, grouped by class ID
- Returns
the name of the new domain
- version()¶
- olivepy.api.oliveclient.package_buffer_audio(audio, data, num_samples, sample_rate=8000, num_channels=1)¶
Helper function to wrap audio data (decoded samples) into a AudioBuffer message that can submitted to the server instead of a file name.
- Parameters
data – the data as a numpy ndarray
num_samples – the number of samples
sample_rate – the audio sample rate
num_channels – the number of channels in the audio
- Returns
- olivepy.api.oliveclient.get_bit_depth(audio)¶
Not using since not assuming numpy is available…
- class olivepy.api.oliveclient.ClientBrokerWorker(status_socket, client_id)¶
Bases:
threading.Thread
Performs async interactions with Olive
- enqueueRequest(message, callback)¶
- stopWorker()¶
- add_event_callback(callback)¶
- run()¶
Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
olivepy.api.workflow module¶
- exception olivepy.api.workflow.WorkflowException¶
Bases:
Exception
This exception means that an error occurred handling a Workflow
- class olivepy.api.workflow.OliveWorkflowDefinition(filename)¶
Bases:
object
Used to load a Workflow Definition from a file.
- get_json(indent=1)¶
Create a JSON structure of the Workflow
- Parameters
indent – if a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation. A negative value will return the JSON document
- Returns
A JSON (dictionary) representation of the Workflow Definition
- to_json(indent=None)¶
Generate the workflow as a JSON string
- Parameters
indent – if a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines.
None
is the most compact representation. A negative value will return the JSON document- Returns
the Workflow Definition as as JSON string:
- create_workflow(client)¶
Create a new, executable (actualized), Workflow, which can be used to make OLIVE analysis, or enrollment requests
- Parameters
client (
AsyncOliveClient
) – an open client connection to an OLIVE server- Returns
a new OliveWorkflow object, which has been actualized (activated) by the olive server
- class olivepy.api.workflow.OliveWorkflow(olive_async_client, actualized_workflow)¶
Bases:
object
An OliveWorkflow instance represents a Workflow Definition actualized by an OLIVE server. Once actualized, an OliveWorkflow instance is used to make analysis, or enrollment/unenrollment requests. An OliveWorkflow should be created using an OliveWorkflowDefinition’s create_workflow() method. All calls to the server include an optional callback. When the callback is provided, the call does not block and the callback method is invoked when a response is received from the server. A callback method has 3 arguments: the original request, the response, and an error message if the request failed.
- Raises
WorkflowException – If the workflow was not actualized
- get_analysis_job_names()¶
The names of analysis jobs in this workflow (usually only one analysis job)
- Return type
List
[str
]- Returns
A list of analysis job names in this workflow
- get_enrollment_job_names()¶
The names of enrollment jobs in this workflow. There should be one enrollment job for each analysis tasks that supports class enrollment
- Return type
List
[str
]- Returns
A list of enrollment job names in this workflow
- get_unenrollment_job_names()¶
The names of un-enrollment jobs in this workflow. There should be one un-enrollment job for each analysis task that supports class un-enrollment
- Return type
List
[str
]- Returns
A list of un-enrollment job names in this workflow
- get_analysis_tasks(job_name=None)¶
Return a list of tasks supported by this workflow. These names are unique and can generally be assumed they are named after the task type (SAD, LID, SID, etc) they support but they could use alternate names if there are multiple tasks with the same task type in a workflow (for example a workflow could have a SAD task that does frame scoring and a SAD task that does regions scoring)
- Parameters
job_name (
Optional
[str
]) – filter the returned task names to those belonging to this job name. Optional since most workflows only support one analysis job.- Return type
List
[str
]- Returns
a list of task names
- get_enrollment_tasks(job_name=None, type=2)¶
Return a list of tasks that support enrollment in this workflow.
- Parameters
job_name (
Optional
[str
]) – optionally the name of the enrollment job. Optional since most workflows only support one job- Return type
List
[str
]- Returns
a list of task names
- get_unenrollment_tasks(job_name=None)¶
Return a list of tasks that support UNenrollment in this workflow.
- Parameters
job_name (
Optional
[str
]) – optionally the name of the enrollment job. Optional since most workflows only support one job- Return type
List
[str
]- Returns
a list of task names
- get_analysis_task_info()¶
A JSON like report of the tasks used for analysis from the actualized workflow. When possible, this report includes the plugins used in the workflow (although there can be cases when the final plugin/domain used is not known until runtime)
- Return type
List
[Dict
[str
,Dict
]]- Returns
JSON structured detailed information of analysis tasks used in this workflow
- to_json(indent=None)¶
Generate the workflow as a JSON string :param indent: if a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines.
None
is the most compact representation. A negative value will return the JSON document- Returns
the Workflow Definition as as JSON string:
- serialize_audio(filename)¶
Helper function used to read in an audio file and output a serialized buffer. Can be used with package_audio() when using the AUDIO_SERIALIZED mode and the audio input has not already been serialized
- Parameters
filename (
str
) – the local path to the file to serialize- Return type
AnyStr
- Returns
the contents of the file as a byte buffer, otherwise an exception if the file can not be opened. This buffer contains the raw content of the file, it does NOT contain encoded samples
- package_audio(audio_data, mode=AudioTransferType.AUDIO_SERIALIZED, annotations=None, task_annotations=None, selected_channel=None, num_channels=None, sample_rate=None, num_samples=None, validate_local_path=True, label=None)¶
Creates an Audio object that can be submitted with a Workflow analysis, enrollment, or adapt request.
- Parameters
audio_data (
AnyStr
) – the input data is a string (file path) if mode is ‘AUDIO_PATH’, otherwise the input data is a binary buffer. Use serialize_audio() to serialize a file into a buffer, or pass in a list of PCM_16 encoded samplesmode – specifies how the audio is sent to the server: either as (string) file path or as a binary buffer. NOTE: if sending a path, the path must be valid for the server.
annotations (
Optional
[List
[Tuple
[float
,float
]]]) – optional regions (start/end regions in seconds) as a list of tuples (start_seconds, end_seconds)task_annotations (
Optional
[Dict
[str
,Dict
[str
,List
[Tuple
[float
,float
]]]]]) – optional and more regions (start/end regions in seconds) targeted for a task and classifed by a lable (such as speech, non-speech, speaker). For example: {‘SHL’: {‘speaker’’:[(0.5, 4.5), (6.8, 9.2)]}, are annotations for the ‘SHL’ task, which are labeled as class ‘speaker’ having regions 0.5 to 4.5, and 6.8 to 9.2. Use get_analysis_tasks() to get the name of workflow tasks .selected_channel (
Optional
[int
]) – optional - the channel to process if using multi-channel audionum_channels (
Optional
[int
]) – The number of channels if audio input is a list of decoded (PCM-16) samples, if not using a buffer of PCM-16 samples this is value is ignoredsample_rate (
Optional
[int
]) – The sample rate if audio input is a list of decoded (PCM-16) samples, if not using a buffer of PCM-16 samples this is value is ignorednum_samples (
Optional
[int
]) – The number of samples if audio input is a list of decoded (PCM-16) samples, if not using a buffer of PCM-16 samples this is value is ignoredvalidate_local_path (
bool
) – If sending audio as as a string path name, then check that the path exists on the local filesystem. In some cases you may want to pass a path which is valid on the server but not this client so validation is not desiredlabel – an optional name to use with the audio
- Return type
WorkflowDataRequest
- Returns
A populated WorkflowDataRequest to use in a workflow activity
- package_text(text_input)¶
Not yet supported
- Parameters
text_input (
str
) – a text input- Return type
WorkflowDataRequest
- Returns
TBD
- package_image(image_input)¶
Not yet supported
- Parameters
image_input – An image input
- Return type
WorkflowDataRequest
- Returns
TBD
- package_video(video_input)¶
Not yet supported
- Parameters
video_input – a video input
- Return type
WorkflowDataRequest
- Returns
TBD
- get_analysis_class_ids(callback=None)¶
Query OLIVE for the current class IDs (i.e. speaker names for SID, keywords for QbE, etc). For tasks that support enrollment, their class IDs can change over time.
- Parameters
callback – an optional callback method that accepts a OliveClassStatusResponse object. Such as: my_callback(result : response.OliveClassStatusResponse)
- Return type
- Returns
an OliveClassStatusResponse object if no callback specified, otherwise the callback receives the OliveClassStatusResponse object when a response is received from the OLIVE server
- analyze(data_inputs, callback=None, options=None)¶
Perform a workflow analysis
- Parameters
data_inputs (
List
[WorkflowDataRequest
]) – a list of data inputs created using the package_audio(), package_text(), package_image(), or package_video() method.callback – an optional callback that is invoked with the workflow completes. If not specified this method blocks, returning OliveWorkflowAnalysisResponse when done. Otherwise this method immediately returns and the callback method is invoked when the response is received. The callback method signature requires 3 arguments: requst, result, error_mssage.
options (
Optional
[str
]) – a JSON string of name/value options to include with the analysis request such as ‘{“filter_length”:99, “interpolate”:1.0, “test_name”:”midge”}’
- Return type
- Returns
an OliveWorkflowAnalysisResponse (if no callback provided)
- enroll(data_inputs, class_id, job_names, callback=None, options=None)¶
Submit data for enrollment.
- Parameters
data_inputs (
List
[WorkflowDataRequest
]) – a list of data inputs created using the package_audio(), package_text(), package_image(), or package_video() method.class_id (
str
) – the name of the enrollmentjob_names (
List
[str
]) – a list of job names, where the audio is enrolled with these jobs support enrollment. This value can be None, in which case the data input(s) is enrolled for each job.callback – an optional callback that is invoked when the workflow completes. If not specified this method blocks, returning an OliveWorkflowAnalysisResponse when the enrollment completes on the server. Otherwise this method immediately returns and the callback method is invoked when the response is received.
options – a dictionary of name/value option pairs to include with the enrollment request
- Returns
server enrollment response if no callback provided
- unenroll(class_id, job_names, callback=None, options=None)¶
Submit a class id (speaker name, language name, etc) for un-enrollment.
- Parameters
class_id (
str
) – the name of the enrollment class to removejob_names (
List
[str
]) – a list of job names, where the class is to be unenrolled. Jobs must support class modification . This value can be None, in which case the data input(s) is unenrolled for each job (which is likely dangerous).callback – an optional callback that is invoked when this workflow action completes. If not specified this method blocks, returning an OliveWorkflowAnalysisResponse when the enrollment completes on the server. Otherwise this method immediately returns and the callback method is invoked when the response is received.
options – a dictionary of name/value option pairs to include with the enrollment request
- Returns
server unenrollment response if no callback provided
- adapt(data_input, callback, options=None, finalize=True)¶
NOT YET SUPPORTED – and not sure it will ever be supported via workflow
- Parameters
data_input –
callback –
options –
finalize –
- Returns
not supported