Tensoract SDK¶
Tensoract Studio provides python SDK which is thin wrapper on REST APIs https://api.tensoract.com/docs/
The SDK offers a number of useful methods to automate operational tasks in the workbench.
Generate API key¶
All SDK / API operations require the client to authenticate using an API key. An user with “API User” role will have privilege to generate the API key. Following are the instructions to generate API Key:
Installation¶
Tensoract Python SDK can be installed using pip:
$ pip install tensoract
Once installed, proceed to the following section to initialize the client using your API key.
Client¶
The client can be initialized as shown below:
Request Syntax
from pprint import pprint from tensoract.client import Tensoract client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY")
- type api_url:
String
- param api_url:
The API URL endpoint. This is an optional argument for private Installations.
- type api_key:
string
- param api_key:
API Key to authenticate the client.
Modules¶
Tensoract Studio offers a vast set of functionalities ranging from user management to managing entire project lifecyle involving datasets and tasks. Following are available functions in each module.
Project¶
Below methods operate within the Project context
- create_project(body)¶
Creates a new project programatically using create_project
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") body = { "project_name": "TestProject", "project_type": "NER", "enable_text_mode_option": True, "disable_quality_audit": True, ... } # check API docs for the full JSON body structure https://api.tensoract.com/docs/#/projects/upload_project pprint(client.create_project(body))
- Parameters:
body (JSON Object) – JSON object with elements defined as here and further explained at
ner
- get_project(project_id)¶
Retrieves project details based on project_id. For more information see get_project.
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") # Invoke get_project method response = client.get_project(project_id="449354de1168469a8229f605") pprint(response)
- Parameters:
project_id (String) – Internal project_id assigned to the Project within Tensoract Workbench.
Response
The requested project’s configuration is returned in JSON format.
{ "project_name": "TestProject", "project_type": "NER|OCR|", "enable_text_mode_option": True, "disable_quality_audit": True, ... }
- update_project(project_id, body)¶
Updates configuration of an existing project in the workbench based on the provided project_id and body JSON parameter.
Sample Invocation
from pprint import pprint from Tensoract import Tensoract # Initialize Tensoract client client = tensoract.Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") # Set the JSON config in body body = { "project_name": "TestProject", "project_type": "NER", "enable_text_mode_option": True, "disable_quality_audit": True, ... } # Invoke update_project method response = client.update_project(project_id="449354de1168469a8229f605",body=body) pprint(response)
- Parameters:
project_id (String) – Internal project_id assigned to the Project within Tensoract Workbench.
body (JSON Object) –
JSON object with elements defined as here and further explained at
ner
Response
The updated project’s new configuration is returned in JSON format.
{ "project_name": "TestProject", "project_type": "NER", "enable_text_mode_option": True, "disable_quality_audit": True, ... }
- get_projects(project_id, project_name, active)¶
Fetches a list of projects that meet the criteria defined by the parameters (project_id or project_name or active status)
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") # Invoke get_projects method response = client.get_projects(project_id=None,project_name="NER_Project",active=True) pprint(response)
- Parameters:
project_id (String) – Internal project_id assigned to the Project within Tensoract Workbench.
project_name (String) – Project Name defined for this project in Tensoract workbench.
active (Boolean) – Project state is active or not.
All the above three parameters can be applied as filters with AND criteria. When all three parameters are set to None, then no filter is applied and all projects are returned
Response
JSON list of projects is returned as below
[ {'company': '60f38299446de8dabe9207e5', 'company_name': 'Objectways', 'project_id': '8205f4dd2319fa0fc33b14a5', 'project_name': 'NER_Project', 'project_type': 'NER'} ]
- delete_project(project_id)¶
Deletes an existing project in the workbench based on the provided project_id parameter.
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") # Invoke delete_project method response = client.delete_project(project_id="8bc05ec26ab161e218a0e842",) pprint(response)
- Parameters:
project_id (String) – Internal project_id assigned to the Project within Tensoract Workbench.
Response
Status of the delete operation is returned as a JSON
{ 'message': 'project deleted', 'status': 1 }
Tasks¶
Below methods operate within the Tasks context
- add_task(body)¶
Add a single task item to a given project
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") body= { "project_id": "179cd15e334f9a63e2a9632a", "item_id": "5835e22985bb0ca47a9fa96e" } # Invoke add_task method pprint(client.add_task(body))
- Parameters:
body (JSON Object) –
JSON Object with following elements
status - “success” or an error status
value - Count of task added to project
task_ids - An array of task_ids
Response
Task details returned as a JSON
{ "status": "success", "value": "1 item(s) added to project", "task_ids": [ "c1b160d50814fdf190eb12fc" ] }
- add_bulk_tasks(body)¶
Add a list of task items to a given project
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") # Define bulk task JSON payload body = { "project_id": "cd1a965e334a9a63e2f17932", "task_list": [ { "source": "s3://demo-examples/pdfs/document.pdf", "annotations": "s3://demo-examples/pdfs/annotation.json" }, { "source": "s3://demo-examples/pdfs/document2.pdf" }, { "source": "s3://demo-examples/pdfs/document3.pdf", "annotations": { "tags": [ { "page": 1, "range": [ 192, 198 ], "text": "Oxford", "id": 1, "type": "NAME" } ] } } ] } # Invoke method to add bulk tasks pprint(client.add_bulk_tasks(body))
- Parameters:
body (JSON Object) –
JSON Object with following elements
status - “success” or an error status
value - Count of task added to project
task_ids - An array of task_ids
Response
Status of the operation is returned as a JSON
{ "status": "success", "value": "2 item(s) added to project", "task_ids": [ "aa7b5455f31a2910e9e41e12", "6dae0d4817c9b9b1985e2a0a" ] }
- add_labels_to_task(task_id, body))¶
Add labels to a given task
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") task_id = "4d572fef4ec4bc9d86bd7b2f" body = { "annotations": "s3://demo-examples/pdfs/annotation.json" } pprint(client.add_labels_to_task(task_id=task_id,body=body))
- Parameters:
task_id (String) – Internal task_id for the given task in Tensoract workbench
body (JSON Object) –
JSON Object with following elements
annotations - s3 reference to the json payload containing annotations for the given task.
Response
Status of the operation is returned as a JSON
{'task_id': '4d572fef4ec4bc9d86bd7b2f'}
- add_task_file(project_id, file_path, mime_type, annotations)¶
Add a local file as a task item to given project
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") data = client.add_task_file( project_id="449354de1168469a8229f605", file_path="examples/pdfs/document.pdf", mime_type="application/pdf", annotations=None ) pprint(data)
- Parameters:
project_id (String) – Internal project_id for the given project in Tensoract workbench
file_path (String) – local file path to the document/image to be added to the task
mime_type (String) – mime_type of the local file to be added
annotations (String) – annotations to be added to the task item
Response
Status of the operation is returned as a JSON
{'_id': '6311e17a412bf7b26e6f6649', 'active': True, 'company': '60f38299446de8dabe9207e5', 'created': 1662116218, 'deep_link': None, 'fileId': 'fc879a309df1b8c1efd7f380', 'modified': 1662116218, 'name': 'document.pdf', 'preview': '', 'project': '449354de1168469a8229f605', 'qcEmail': [], 'source': 'file:449354de1168469a8229f605/fc879a309df1b8c1efd7f380', 'state': 16, 'type': 'application/pdf', 'userEmail': []}
- get_task(task_id)¶
Retrieve a task
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") data = client.get_task(task_id="449354de1168469a8229f605") pprint(data)
- Parameters:
task_id (String) – Internal task_id for the given task in Tensoract workbench
Response
Task details returned as a JSON
{ 'company': '60f38299446de8dabe9207e5', 'company_name': 'Objectways', 'file_type': 'application/pdf', 'plain_text': {'1': '2/27/2021 Amazon.com: Customer reviews: OPI Nail ' 'Lacquer, A Great Opera Tunity ' 'https://www.amazon.com/gp/customer -reviews/B00014353Y/ ' '1/5 Skip to main content Top reviews All reviewers All ' '.........................................................' 'Select your address Returns & Orders All Account Hello, ' 'Sign in 0'} 'project_id': '557b89e25a0588898fae91f0', 'project_name': 'NER_PROJECT_AUTO', 'project_type': 'NER', 'source': 's3://Tensoract-demo-examples/sample.pdf', 'state': 0, 'state_description': 'Unassigned', 'task_id': '449354de1168469a8229f605'
}
- get_tasks(project_id, task_id, file_name, file_type, trail)¶
Retrieve a list of tasks matching the filter criteria
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") tasks = client.get_tasks( project_id="557b89e25a0588898fae91f0", task_id="16e2a709994421da996cef4f", file_name=None, file_type=None, trail = False ) pprint(tasks)
- type project_id:
String
- param project_id:
Internal project_id for the given project in Tensoract workbench
- type task_id:
String
- param task_id:
Internal task_id for the given task in Tensoract workbench
- type file_name:
String
- param file_name:
file_name metadata assigned to the task
- type file_type:
String
- param file_type:
file_type metadata assigned to the task
- type trail:
Boolean
- param trail:
trail
Response
JSON List of tasks matching the filter criteria.
[ { 'company': '60f38299446de8dabe9207e5', 'file_type': 'application/pdf', 'project_id': '557b89e25a0588898fae91f0', 'source': 's3://Tensoract-demo-examples/sample.pdf', 'state': 0, 'state_description': 'Unassigned', 'task_id': '16e2a709994421da996cef4f' } ]
- delete_task(task_id)¶
Delete the given task item
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") data = client.delete_task(task_id="449354de1168469a8229f605") pprint(data)
- Parameters:
task_id (String) – Internal task_id for the given task in Tensoract workbench
Response
Status of the operation is returned as a JSON
{'message': 'Task deleted sucessfuly', 'status': 1}
- export_tasks(project_id)¶
Export all tasks from a given project as JSON list
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") response = client.export_tasks(project_id="449354de1168469a8229f605") pprint(response)
- Parameters:
project_id (String) – Internal project_id for the given project in Tensoract workbench
Response
Export status with url
{'message': 'The export is being generated, please try again in a few seconds ' 'to check the export status', 'progress': '0%', 'status': 'IN PROGRESS'} {'export_url': 'https://devdocumentsdemo.objectways.com/export_ner_project_auto_2022-09-02T09:23:34.9944468.manifest', 'message': 'Use the export_url to download the project export file', 'progress': '100%', 'status': 'COMPLETED'}
- get_word_boxes(body)¶
Get Bounding Box coordinates of all pages in a document. Optionally pass “page” number to restrict by the page
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") response = client.get_word_boxes(task_id="449354de1168469a8229f605", page = 1) pprint(response)
- Parameters:
task_id (String) – Internal task_id for the given task in Tensoract workbench
page (Integer) – Page number to which this operation should be restricted to.
Response
JSON list of Bounding box co-ordinates with related details
[ [ { 'box': [0.04322405692755147, 0.020058986644677534, 0.11036431902612907, 0.030159995920771787], 'range': [0, 9], 'text': '2/27/2021' }, { 'box': [0.3196231438320821, 0.020058986644677534, 0.4089945621543309, 0.030159995920771787], 'range': [10, 21], 'text': 'Amazon.com:'}, { 'box': [0.2981259968948721, 0.9708164847570528, 0.4446869530303018, 0.9809174940331471], 'range': [114, 134], 'text': '-reviews/B00014353Y/' } ] ]
Teams¶
Below methods operate within the Teams context and can be used to manage team members in a project.
- add_team_member(project_id, email, role)¶
Add a team member to collaborate on an existing project.
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") member = client.add_team_member(project_id="449354de1168469a8229f605", email="someone@email.com", role="annotator|reviewer|supervisor")
- Parameters:
project_id (String) – Internal project_id for the given project in Tensoract workbench
email (String) – Email id of an existing user to be added to the project as a collaborator
role (String) – role assigned to the team member. This should be one of annotator or reviewer or supervisor
Response
Status of the operation is returned as a JSON
{'message': 'user added to the project team', 'status': 1}
- get_project_team_members(project_id)¶
Return list of team members assigned to a project.
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") team = client.get_project_team_members(project_id="449354de1168469a8229f605") :type project_id: String :param project_id: Internal project_id for the given project in Tensoract workbench **Response** JSON list of team members in the given project :: [{'email': '1@an.com', 'role': 'annotator'}, 'email': 'bobmorgan@me.com', 'role': 'annotator'}, 'email': 'q1@qc.com', 'role': 'reviewer'}]
- remove_project_team_member(project_id, email)¶
Remove the given team member from an existing project.
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") team = client.remove_project_team_member(project_id="449354de1168469a8229f605", email="someone@email.com" )
- Parameters:
project_id (String) – Internal project_id for the given project in Tensoract workbench
email (String) – Email id of an existing user to be removed from the project as a collaborator
Response
Status of the operation is returned as a JSON
{'message': 'user deleted from project team', 'status': 1}
Dataset¶
Below methods operate within the Dataset context
- create_dataset(body)¶
Creates a new dataset based on configuration settings provided in the JSON body.
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") body = { 'dataset_name': 'Test Dataset Demo', 'dataset_description': 'This is a test Dataset', 'dataset_items': 0, 'dataset_type': 'Image', .... } # check API docs for the full JSON body structure https://api.tensoract.com/docs/#/datasets/upload_dataset pprint(client.create_dataset(body))
- Parameters:
body (JSON Object) –
JSON object with elements defined as here
- get_dataset(dataset_id)¶
Fetches configuration details of an existing dataset in the workbench based on the provided dataset_id parameter.
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") # Invoke get_dataset method response = client.get_dataset(dataset_id="449354de1168469a8229f605") pprint(response)
- Parameters:
dataset_id – Internal dataset_id assigned to the Dataset within Tensoract Workbench.
Response
The requested dataset’s configuration is returned in JSON format.
{ 'dataset_name': 'Test Dataset Demo', 'dataset_id': '5c1d6892f4712fde11d8e25a', 'dataset_description': 'This is a test Dataset', 'dataset_items': 0, 'dataset_type': 'Image' ..... }
- update_dataset(dataset_id, body)¶
Updates configuration of an existing dataset in the workbench based on the provided dataset_id and body JSON parameter.
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") # Set the JSON config in body body = { 'dataset_name': 'Test Dataset Demo', 'dataset_description': 'This is a test Dataset', 'dataset_items': 0, 'dataset_type': 'Image' ...... } # Invoke update_dataset method response = client.update_dataset(dataset_id="449354de1168469a8229f605",body=body) pprint(response)
- Parameters:
dataset_id – Internal dataset_id assigned to the Dataset within Tensoract Workbench.
body (JSON Object) –
JSON object with elements defined as here
Response
The updated dataset’s new configuration is returned in JSON format.
{ 'dataset_name': 'Test Dataset Demo', 'dataset_description': 'This is a test Dataset', 'dataset_items': 0, 'dataset_type': 'Image' ...... }
- list_datasets(dataset_id, dataset_name, active)¶
Fetches a list of datasets that meet the criteria defined by the parameters (dataset_id or dataset_name or active status)
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") # Invoke list_datasets method response = client.list_datasets(dataset_id=None,dataset_name="Test Dataset Demo",active=True) pprint(response)
- Parameters:
dataset_id – Internal dataset_id assigned to the Dataset within Tensoract Workbench.
dataset_name (String) – Dataset Name defined for this dataset in Tensoract workbench.
active (Boolean) – Dataset state is active or not.
All the above three parameters can be applied as filters with AND criteria. When all three parameters are set to None, then no filter is applied and all datasets are returned
Response
JSON list of datasets is returned as below
[ {'company': '60f38299446de8dabe9207e5', 'company_name': 'Objectways', 'dataset_id': '2dfc93fb1723921e8bad8027', 'dataset_name': 'Test Dataset Demo', 'dataset_type': 'Image',} ]
- delete_dataset(dataset_id)¶
Deletes an existing dataset in the workbench based on the provided dataset_id parameter.
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") # Invoke delete_dataset method response = client.delete_dataset(dataset_id="8bc05ec26ab161e218a0e842") pprint(response)
- Parameters:
dataset_id (String) – Internal dataset_id assigned to the Dataset within Tensoract Workbench.
Response
Status of the delete operation is returned as a JSON
{ 'message': 'dataset deleted', 'status': 1 }
Dataset Items¶
Below methods operate within the Dataset Items context
- create_dataset_item(body)¶
Add dataset items to a given dataset
Admin can post the metadata with the items as below
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") body = { "dataset_id": "208eb554d3fa1e161b2c6a44", "dataset_items": [ { "meta_data": { "batch": "10", "test": "cell" }, "source": "s3://mybucket/test-dataset/file1.tiff" }, { "meta_data": { "batch": "1", "test": "cell" }, "source": "s3://mybucket/test-dataset/file2.tiff" } .... .... ] } # Invoke create_dataset_item method pprint(client.create_dataset_item(body))
- Parameters:
body (JSON Object) –
JSON Object with following elements
dataset_id - datatset to which the items needs to be added
Metadata - Metadata can de added with dataset item
source - link to S3 source of the document/image.
Response
Status of operation is returned as a JSON
{'inserted_items': 11, 'status': 1}
- get_dataset_item(item_id)¶
Retrieve a dataset item
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") data = client.get_dataset_item(item_id="449354de1168469a8229f605") pprint(data)
- Parameters:
item_id (String) –
Internal item_id for the given dataset item in Tensoract workbench
Response
Dataset Item details returned as a JSON
[{'company': '60f38299446de8dabe9207e5', 'company_name': 'Objectways', 'dataset_id': '2ed8316fe3691cea93b8d70c', 'file_name': '10_2a68e073-b0b2-eb11-80cb-484d7e9f90c1.tiff', 'file_type': 'image/tiff', 'intermediate_source': 's3://Tensoract-demo-examples/sample.png', 'item_id': '0d1f56964171e372afa90323', 'source': 's3://Tensoract-demo-examples/sample.tiff', 'state': 0, 'version': [0]}]
- delete_dataset_item(item_id)¶
Delete the given dataset item
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") data = client.delete_dataset_item(item_id="6bae961fcebe81cbacbedec6") pprint(data)
- Parameters:
item_id (String) – Internal item_id for the given dataset item in Tensoract workbench
Response
Status of the operation is returned as a JSON
{ "message": "dataset item deleted", "status": 1 }
- list_dataset_items(dataset_id, dataset_version)¶
Retrieve a list of dataset items matching the filter criteria
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") dataset_items = client.list_dataset_items(dataset_id="2ed8316fe3691cea93b8d70c",dataset_version="0")
- Parameters:
dataset_id – Internal dataset_id for the given dataset in Tensoract workbench
dataset_version (String) – Internal dataset_version for the given datasetk in Tensoract workbench
Response
JSON List of tasks matching the filter criteria.
{'company': '60f38299446de8dabe9207e5', 'company_name': 'Objectways', 'dataset_id': '3aa168a963f1d4dbe0b1f549', 'file_name': 'violet.tiff', 'file_type': 'image/tiff', 'item_id': '6bae961fcebe81cbacbedec6', 'meta_data': {'color': 'violet'}, 'source': 'file:3aa168a963f1d4dbe0b1f549/6bae961fcebe81cbacbedec6', 'state': 0, 'tags': {'a dataset tag': 1}, 'version': [0]}
Project Export¶
Below methods operate within the Project Export context
- export_project_tasks(project_id)¶
Export all tasks from a given project as JSON list
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract (api_url="YOUR_API_URL",api_key="YOUR_API_KEY") projects = client.export_project_tasks(project_id="1e80e389c318d5746169c5b6", export_note="This is test export via API") pprint(projects)
- Parameters:
project_id (String) – Internal project_id for the given project in Tensoract workbench
Response
Export status
{'message': 'The export is being generated, please try again in a few seconds ' 'to check the export status', 'progress': '0%'} {'progress': '100%'}
- list_project_exports(project_id)¶
This method enlists the exports exported in the project.
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") response = client.list_project_exports( project_id="449354de1168469a8229f605")
- Parameters:
project_id (String) – Internal project_id for the given project in Tensoract workbench
Response
[{ 'created': 1667897879, 'createdBy': 'abc@example.com', 'exportId': '**************', 'filter': '', 'items': 41, 'note': 'This is test export via API', 'project': 'd2ff8489f14f0b1b59ec1df7', 'projectName': 'test10', 'selection': False}]
- download_project_export(export_id)¶
It downloads the exports with given export id.
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") response = client.download_project_export(export_id="449354de1168469a8229f605")
Response
{'export_url': 'https://devdocuments.objectways.com/export_2022-10-20T09:54:14.7355669_project1.manifest', 'message': 'Use the export_url to download the project export file', 'progress': '100%', 'status': 'COMPLETED'}
Dataset Export¶
Below methods operate within the Dataset Export context
- export_dataset(dataset_id)¶
Export all dataset items from a given dataset as JSON list.
Dataset can be exported with GroudTruth filter
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") response = client.export_dataset( dataset_id="3aa168a963f1d4dbe0b1f549", export_note="This is test export via API", project_id="449354de1168469a8229f606")
- Parameters:
dataset_id (String) – Internal dataset_id for the given dataset in Tensoract workbench
Response
Export status
{'progress': '100%'}
- list_dataset_exports(dataset_id)¶
This method enlisits the exports exported in the dataset.
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") response = client.list_dataset_exports(dataset_id="449354de1168469a8229f605")
- Parameters:
dataset_id – Internal dataset_id for the given Dataset in Tensoract workbench
Response
[ {'created': 1667901440, 'createdBy': 'abc@example.com', 'datasetId': '3aa168a963f1d4dbe0b1f549', 'exportId': '***************', 'filter': '', 'items': 44, 'note': 'This is test export via API', 'project': '', 'projects': [], 'selection': False} ]
- download_dataset_export(export_id)¶
It downloads the exports with given export id.
Sample Invocation
from pprint import pprint from tensoract.client import Tensoract # Initialize Tensoract client client = Tensoract(api_url="YOUR_API_URL",api_key="YOUR_API_KEY") response = client.download_dataset_export(export_id="449354de1168469a8229f605")
Response
{'export_url': 'https://devdocuments.objectways.com/export_2022-08-20T14:55:09.5593106_goldenset1.manifest', 'message': 'Use the export_url to download the project export file', 'progress': '100%', 'status': 'COMPLETED'}