Skip to main content

Библиотека для использования 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


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.3.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rumoderatorai-0.1.3-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file rumoderatorai-0.1.3.tar.gz.

File metadata

  • Download URL: rumoderatorai-0.1.3.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.2

File hashes

Hashes for rumoderatorai-0.1.3.tar.gz
Algorithm Hash digest
SHA256 55ee392b289ca0521eb6ac80a2dbc4f0ec5087dc6f23c5f81cb7d8d464e24737
MD5 49b447b6de342015dddffea5dacedd29
BLAKE2b-256 efeb004dbbb14deb967eb8ee80f258ebda9a82a773505f7860e6fc866e7be376

See more details on using hashes here.

File details

Details for the file rumoderatorai-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: rumoderatorai-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.2

File hashes

Hashes for rumoderatorai-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 98a37e39bb4575ffbfec7430a9fdfe2efdd22219197d7e55b0774151a71f174b
MD5 12035dbe5ca30581ef381aacad913374
BLAKE2b-256 a6462a1357b5fc7cd9037b1763bd264ae0c6a1886bd43d4044b50ff503bbb79d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page