From b4b9eb3a1f3ca3e12b3fd8a61e7760b48c0bbd2d Mon Sep 17 00:00:00 2001 From: Vaghinak Basentsyan Date: Mon, 12 Dec 2022 13:12:19 +0400 Subject: [PATCH] Docs update --- README.rst | 50 ++++++++++++++++++++++++----------------- docs/source/index.rst | 52 ++++++++++++++++++++++++++++++++++++------- 2 files changed, 73 insertions(+), 29 deletions(-) diff --git a/README.rst b/README.rst index d95540dba..4d7c71847 100644 --- a/README.rst +++ b/README.rst @@ -27,35 +27,41 @@ Authentication .. code-block:: python - >>> from superannotate import SAClient - # by environment variable SA_TOKEN - >>> sa_client = SAClient() - # by token - >>> sa_client = SAClient(token='') - # by config file - # default path is ~/.superannotate/config.json - >>> sa_client = SAClient(config_path='~/.superannotate/dev_config.json') + from superannotate import SAClient + # by environment variable SA_TOKEN + sa_client = SAClient() + # by token + sa_client = SAClient(token='') + # by config file + # default path is ~/.superannotate/config.json + sa_client = SAClient(config_path='~/.superannotate/dev_config.json') Using superannotate ------------------- .. code-block:: python - >>> from superannotate import SAClient - >>> sa_client =SAClient() - >>> project = 'Dogs' - >>> sa_client.create_project( + from superannotate import SAClient + + + sa_client =SAClient() + + project = 'Dogs' + + sa_client.create_project( project_name=project, project_description='Test project generated via SDK', project_type='Vector' ) - >>> sa_client.create_annotation_class( - project=project, - name='dog', - color='#F9E0FA', - class_type='tag' - ) - >>> sa_client.attach_items( + + sa_client.create_annotation_class( + project=project, + name='dog', + color='#F9E0FA', + class_type='tag' + ) + + sa_client.attach_items( project=project, attachments=[ { @@ -64,7 +70,8 @@ Using superannotate } ] ) - >>> sa_client.upload_annotations( + + sa_client.upload_annotations( project=project, annotations=[ { @@ -75,7 +82,8 @@ Using superannotate } ] ) - >>> sa_client.get_annotations(project=project, items=['dog.jpeg']) + + sa_client.get_annotations(project=project, items=['dog.jpeg']) Installation ------------ diff --git a/docs/source/index.rst b/docs/source/index.rst index 6b52ceeea..05f9272d9 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -29,13 +29,49 @@ SuperAnnotate Python SDK allows access to the platform without web browser: .. code-block:: python - from superannotate import SAClient - - sa = SAClient() - - sa.create_project("Example Project 1", "example", "Vector") - - sa.upload_images_from_folder_to_project("Example Project 1", "") + from superannotate import SAClient + + + sa_client =SAClient() + + project = 'Dogs' + + sa_client.create_project( + project_name=project, + project_description='Test project generated via SDK', + project_type='Vector' + ) + + sa_client.create_annotation_class( + project=project, + name='dog', + color='#F9E0FA', + class_type='tag' + ) + + sa_client.attach_items( + project=project, + attachments=[ + { + 'url': 'https://drive.google.com/uc?export=download&id=1ipOrZNSTlPUkI_hnrW9aUD5yULqqq5Vl', + 'name': 'dog.jpeg' + } + ] + ) + + sa_client.upload_annotations( + project=project, + annotations=[ + { + 'metadata': {'name': 'dog.jpeg'}, + 'instances': [ + {'type': 'tag', 'className': 'dog'} + ] + } + ] + ) + + sa_client.get_annotations(project=project, items=['dog.jpeg']) ---------- @@ -50,7 +86,7 @@ SDK is available on PyPI: pip install superannotate -The package officially supports Python 3.6+ and was tested under Linux and +The package officially supports Python 3.7+ and was tested under Linux and Windows (`Anaconda `_) platforms. For more detailed installation steps and package usage please have a look at