Библиотека для использования RuModeratorAI (https://moderator.pysols.ru)
Project description
RuModeratorAI
Библиотека для использования RuModeratorAI API (https://moderator.pysols.ru).
Установка
pip install rumoderatorai
Пример использования
from rumoderatorai import Client
import asyncio
from PIL import Image
import os
async def main():
async with Client(
api_key=os.getenv("RUMODERATORAI_API_KEY")
) as client:
text_response = await client.get_text_class("Hello, world!")
print(text_response)
profile_response = await client.get_profile_class(
username="test",
first_name="test",
last_name="test",
description="test",
is_premium=False,
)
print(profile_response)
image = Image.open("tests/image.png")
image_response = await client.get_image_class(image)
print(image_response)
ocr_response = await client.get_ocr(image)
print(ocr_response)
stats_response = await client.get_stats()
print(stats_response)
key_info_response = await client.get_key_info()
print(key_info_response)
prediction_response = await client.get_prediction(unique_id=text_response.unique_id)
print(prediction_response)
ips_response = await client.get_ips()
print(ips_response)
prices_response = await client.get_prices()
print(prices_response)
asyncio.run(main())
Или можно использовать без async with:
from rumoderatorai import Client
import asyncio
from PIL import Image
import os
async def main():
client = Client(
api_key=os.getenv("RUMODERATORAI_API_KEY"),
)
await client.init()
text_response = await client.get_text_class("Hello, world!")
print(text_response)
profile_response = await client.get_profile_class(
username="test",
first_name="test",
last_name="test",
description="test",
is_premium=False,
)
print(profile_response)
image = Image.open("tests/image.png")
image_response = await client.get_image_class(image)
print(image_response)
ocr_response = await client.get_ocr(image)
print(ocr_response)
stats_response = await client.get_stats()
print(stats_response)
key_info_response = await client.get_key_info()
print(key_info_response)
prediction_response = await client.get_prediction(unique_id=text_response.unique_id)
print(prediction_response)
ips_response = await client.get_ips()
print(ips_response)
prices_response = await client.get_prices()
print(prices_response)
await client.close()
asyncio.run(main())
Примечание: Не забудьте установить переменную окружения RUMODERATORAI_API_KEY перед запуском кода.
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
rumoderatorai-0.1.5.tar.gz
(6.7 kB
view details)
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 rumoderatorai-0.1.5.tar.gz.
File metadata
- Download URL: rumoderatorai-0.1.5.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec05b40e5e2eaf67986351fc752edd5eab76ea6b848ed0a53c5b33fe0d0b5a90
|
|
| MD5 |
433653d0ee263680d5988e638df99195
|
|
| BLAKE2b-256 |
419ae40c1b9da52d6fca53ce2b98881b7c3070696c06511b8ec61b04f69c70c5
|
File details
Details for the file rumoderatorai-0.1.5-py3-none-any.whl.
File metadata
- Download URL: rumoderatorai-0.1.5-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e63b26f61257dbbc9590407529622679d84b2c86a04411c7fb9a48047b79f87
|
|
| MD5 |
7d34c6d52cefa76bfe021f656553c5f1
|
|
| BLAKE2b-256 |
a3698c03ad1dede3e8b263e8e0b8ac3dd6be2fe42bbd0406c36e00313b251242
|