Библиотека для использования 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)
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)
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.1.tar.gz
(6.1 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.1.tar.gz.
File metadata
- Download URL: rumoderatorai-0.1.1.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e545789158a032ed3421da40cf280f3c2e139b73553da0fe370bfd16307c446
|
|
| MD5 |
be81b9437eb9397ed260e35a4ef905b5
|
|
| BLAKE2b-256 |
d0eff3b6ca4a6561feb6aa1011d4b93e5460c9852e7ea49844aade9b8667f200
|
File details
Details for the file rumoderatorai-0.1.1-py3-none-any.whl.
File metadata
- Download URL: rumoderatorai-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.0 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 |
d2b1b4a3f4da52320b9904053d7f5e937a43dd6e5dceabac0fb5e5e6ea46f3da
|
|
| MD5 |
8811a7c0e371a15fedc09c860b115e5f
|
|
| BLAKE2b-256 |
68dad087069d6045b28a4fedbd3994ce38bda966e0554fdc0093b2549588de04
|