4paradigm AI Cloud Service SDK Library for Python
Project description
AI云平台SDK
这是第四范式提供的AI云平台SDK。通过该sdk可以调用AI云平台提供的各种模型服务。
安装
pip install websockets==10.4
pip install ai-cloud-sdk-4pd
使用
import ai_cloud_sdk_4pd.client as ai_cloud_sdk_4pd_client
import ai_cloud_sdk_4pd.models as ai_cloud_sdk_4pd_models
count = 0
async def on_ready():
print('ready')
async def on_response(response):
global count
print('-------------------------------------')
print(count)
count += 1
print(response)
async def on_completed():
print('completed')
async def test_asr():
print('-------------test asr flow-------------')
token = 'your token'
call_token = 'your call token'
region = 'China'
config = ai_cloud_sdk_4pd_models.Config(
token=token,
call_token=call_token,
region=region,
)
client = ai_cloud_sdk_4pd_client.Client(config=config)
request = ai_cloud_sdk_4pd_models.ASRRequest(
audio_url='your local audio file path',
language='zh',
)
await client.asr_ws_send(
request=request,
on_ready=on_ready,
on_response=on_response,
on_completed=on_completed,
)
print('---------------------------------')
if __name__ == '__main__':
import asyncio
asyncio.get_event_loop().run_until_complete(test_asr())
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
File details
Details for the file ai_cloud_sdk_4pd-0.1.3.tar.gz.
File metadata
- Download URL: ai_cloud_sdk_4pd-0.1.3.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8cebc8b4a816cba5c5cd80225d104310aafb7fb06137c651a318d981f2a81f16
|
|
| MD5 |
eef4a7a62484800fa195e1ab987303dd
|
|
| BLAKE2b-256 |
264978d53c7c6bffa5d0aaf9f379a22d7f14365cb862fc1678a1eba39f63f4cb
|