Skip to main content

Unofficial Python API for Perchance.

Project description

perchance

pypi python CodeFactor BuyMeACoffee

Unofficial Python API for Perchance.

Installation

To install this module, run the following command:

pip install perchance

Examples

Text generation

import asyncio
import perchance

async def main():
    gen = perchance.TextGenerator()
    prompt = "How far is the moon?"

    async for chunk in gen.text(prompt):
        print(chunk, end='')

asyncio.run(main())

Image generation

import asyncio
import perchance
from PIL import Image

async def main():
    gen = perchance.ImageGenerator()
    prompt = "Fantasy landscape"

    async with await gen.image(prompt) as result:
        binary = await result.download()
        image = Image.open(binary)
        image.show()

asyncio.run(main())

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

perchance-0.0.1.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

perchance-0.0.1-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file perchance-0.0.1.tar.gz.

File metadata

  • Download URL: perchance-0.0.1.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Windows/10

File hashes

Hashes for perchance-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c0e6932813573867282814e40a2eab9d98c6cc543aff58f16c440526dc7eeab5
MD5 6835fe9378ff5dda33ac1362d3fd7305
BLAKE2b-256 a6a37c18f7f000744246458a8d05a5c8063dfabd375e0b4098e3511fa650ec7f

See more details on using hashes here.

File details

Details for the file perchance-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: perchance-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Windows/10

File hashes

Hashes for perchance-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 850e85e810b1053fd8d0590aa939b5c1947b518f5bfef9bce7656947c819a572
MD5 d8248d4c0cc46efa5bcd356626d5b553
BLAKE2b-256 3b309eb97bc5565dc44565d22405cea39fcb0ecf8a0a4fd1d93233021ad0c65e

See more details on using hashes here.

Supported by

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