Skip to main content

dds-cloudapi-sdk


The Python SDK for the DDS Cloud API.

License PyPI python PyPI version PyPI - Downloads


The dds-cloudapi-sdk is a Python package designed to simplify interactions with the DDS Cloud API. It features:

  • Straightforward APIs
  • Unified interfaces
  • Handy utilities

Installation

You can get the SDK library directly from PyPi:

pip install dds-cloudapi-sdk

Quick Start

Below is a straightforward example for the popular DINO-X - Detection algorithm:

# 1. Initialize the client with your API token.
from dds_cloudapi_sdk import Config
from dds_cloudapi_sdk import Client

token = "Your API Token Here"
config = Config(token)
client = Client(config)

# 2. Create a task with proper parameters.
from dds_cloudapi_sdk.tasks.v2_task import V2Task, create_task_with_local_image_auto_resize

api_path = "/v2/task/dinox/detection"
api_body = {
    "model": "DINO-X-1.0",
    # "image": "", # image url or base64 encoded
    "prompt": {
        "type":"text",
        "text":"wolf.dog.butterfly"
    },
    "targets": ["bbox", "mask"],
    "bbox_threshold": 0.25,
    "iou_threshold": 0.8,
    "mask_format": "coco_rle",
}

# 2.1. Create task with local image auto resized (Recommended: faster processing)
# task = create_task_with_local_image_auto_resize(
#     api_path=api_path,
#     api_body_without_image=api_body,
#     image_path="local/path/to/infer/image.jpg",
# )

# 2.2. Create task with local image
# from dds_cloudapi_sdk.image_resizer import image_to_base64
# api_body["image"] = image_to_base64("local/path/to/infer/image.jpg")
# task = V2Task(api_path=api_path, api_body=api_body)

# 2.3. Create task with image URL
image_url = "https://dds-frontend.oss-accelerate.aliyuncs.com/static_files/playground/grounding_DINO-1.6/02.jpg"
api_body["image"] = image_url
task = V2Task(api_path=api_path, api_body=api_body)

# 3. Run the task.
# task.set_request_timeout(10)  # set the request timeout in seconds,default is 5 seconds
client.run_task(task)

# 4. Get the result.
print(task.result)

# 5. Visualize the result to local image.
# image_path = "local/path/to/infer/image.jpg" # when using local image
# image_path = image_url # when using image URL
# visualize_result(image_path=image_path, result=task.result, output_dir="path/to/output_dir")

3. Apply for an API Token

Step 1: Apply for API Quota. Step 2: Create projects and get your API token from here.

4. License

This project is released under the Apache 2.0 License.

Copyright 2023-present, IDEA

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

Release files for dds-cloudapi-sdk 0.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dds-cloudapi-sdk 0.5.3
File Size Uploaded
dds-cloudapi-sdk-0.5.3.tar.gz 18.6 kB Details

Release files / dds-cloudapi-sdk-0.5.3.tar.gz

Download URL dds-cloudapi-sdk-0.5.3.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2a0aca8eb6a8b0bd9cd6bf628eef30e89017e5ecbae95abd49366fbb8aed80e2
BLAKE2b-256 checksum
How to use checksums
6ab0edef3c9ceb1efa7196e5e8c19d742e32c8382600c9e958fbfadf00859e70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.16

Release history Release notifications | RSS feed

This release

0.5.3 This release

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.2.5

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.1

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page