W3AI Flatform API
Project description
w3ai-sdk
Description
Using w3ai-sdk package to querry some of data from W3AI Flatform using APIKey. For example , Getting user balance, creating a task, getting task result, getting statistics and history of models, checking API permission ...
Installation
pip install w3ai-python-sdk
Setup
To start, simply require the W3AI-SDK and set up an instance with your W3AI API Keys.Please checking out your W3AI Page. In the example below show you how to using the SDK.
from 'w3ai-python-sdk' import W3AIClient
client = W3AIClient(API_KEY, SERVER_ENDPOINT)
Usage
API Key Permission
client.get_api_key_permission(API_KEY)
Response :
{
status: 'success',
data: {
limit_models: true,
models: [ '7da922fe-02b9-4534-b218-c5b7c79d2195' ]
}
}
Models infomation
client.get_model_info(MODEL_ID)
Response :
{
status: 'success',
data: {
model_id: '7da922fe-02b9-4534-b218-c5b7c79d2195',
api_price: 0.12342134,
model_description: 'this is best model',
commit_hash: 'd1c366e0c6bbfdd28cb31301852030c113013576',
input_format: { input: [Object] },
output_format: { output: [Object] }
}
}
Model serving info
client.check_model_is_serving(MODEL_ID)
Response :
{ status: 'success', data: { consumers: 1, serving: true } }
Task executing cost info
client.get_model_task_cost(MODEL_ID)
Response :
{
status: 'success',
message: 'Success',
data: { cost: 0.011000000000000001, symbol: '$', unit: 'USD' }
}
Creating a task
Argument exmaple:
FILE_LIST = [
{
"key": "input",
"data": "file_stotage_url",
"name": "image.jpg"
},
{
"key": "input2",
"data": "file_stotage_url2",
"name": "image2.jpg"
}
]
INPUT_PARAMS = {
"input": {
"type": "file",
"samples": [],
"required": true,
"mime_type": [
"image/*"
]
}
}
MODEL_ID = "7da922fe-02b9-4534-b218-c5b7c79d2195"
client.create_task(files= FILE_LIST, input_params=INPUT_PARAMS, model_id= MODEL_ID)
Response :
{
status: 'success',
message: 'Success',
data: "e52fa152-351d-4a40-a4ce-83a4ff11d87e"
}
Getting task result
client.get_task_result(task_id = TASK_ID)
Response :
{
"result": {
"additionalProp1": {}
},
"status": "sucess",
"success": true
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file w3ai_sdk-0.0.7.tar.gz.
File metadata
- Download URL: w3ai_sdk-0.0.7.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad6a0165630b432e090665dd7a6c0291918910c515da2c31885a2bc6e5d38ca0
|
|
| MD5 |
9a207b344172fd2899573917e9fe1dc8
|
|
| BLAKE2b-256 |
d9d82ee2ab355aff49ce3edc756f0953b86d5c744b1e6c53b0301111af269735
|
File details
Details for the file w3ai_sdk-0.0.7-py3-none-any.whl.
File metadata
- Download URL: w3ai_sdk-0.0.7-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ace21e35e596208d084b0b5f83c6c479ec9944e51d6214e082ddb715b5ef86d7
|
|
| MD5 |
8c53fb15611d900e18c20e5563d8eec9
|
|
| BLAKE2b-256 |
71f674e0246ed5a1a4d03500a11a16433357b7c17fc1f4575f0b95e0a644eb18
|