Skip to main content

perchance

pypi python BuyMeACoffee

Unofficial Python API for Perchance.

Installation

To install this module, run the following command:

pip install perchance

Examples

Text generation

import asyncio
from perchance import TextGenerator

async def main():
    async with TextGenerator() as gen:
        prompt = "How far is the Moon?"

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

asyncio.run(main())

Image generation

import asyncio
from PIL import Image
from perchance import ImageGenerator

async def main():
    async with ImageGenerator() as gen:
        prompt = "Fantasy landscape"

        result = await gen.image(prompt, shape='landscape')
        binary = await result.download()
        image = Image.open(binary)
        image.show()

asyncio.run(main())

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

Uploaded Source

Built Distribution

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

perchance-0.1.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: perchance-0.1.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.1 Windows/11

File hashes

Hashes for perchance-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e316bbda3def237320debfa5799d26634c2efa9a33fb3a3b7364267d4a9d1adb
MD5 091aa3e9ebb71678f2b86efc539ce143
BLAKE2b-256 cb5aecbd19c439add5d9b42c64d672afbe124470ad80514ea2474349e13c8ee8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: perchance-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.1 Windows/11

File hashes

Hashes for perchance-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cca446620dff13a92a9c834122a9675dad209a37d35178ae7e177f24336cd2ff
MD5 357cd8c0436a8898d4ece0af5b77b536
BLAKE2b-256 58593fc6b469692249889da2c3940bc4f04c1dd024e501cdff843f626f3e9eaf

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

0.0.1

2 files

Supported by

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