forked from yandex-cloud/yandex-ai-studio-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
executable file
·26 lines (16 loc) · 697 Bytes
/
run.py
File metadata and controls
executable file
·26 lines (16 loc) · 697 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python3
from __future__ import annotations
import asyncio
from yandex_cloud_ml_sdk import AsyncYCloudML
async def main() -> None:
sdk = AsyncYCloudML(folder_id='yc.fomo.storage.prod.service')
sdk.setup_default_logging()
model = sdk.models.text_classifiers(model_name='yandexgpt-lite', model_version='rc@tamrap1sjscq6e9flit3p')
# result will contain predictions with a predefined classes
# and most powerful prediction will be "mathematics": 0.92
result = await model.run("Vieta's formulas")
for prediction in result:
print(prediction)
print(f'input_tokens= {result.input_tokens}')
if __name__ == '__main__':
asyncio.run(main())