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())

Metadata

Release files for perchance 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for perchance 0.1.0
File Size Uploaded
perchance-0.1.0.tar.gz 8.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for perchance 0.1.0
File Interpreter ABI Platform
perchance-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.2 kB

Release files / perchance-0.1.0.tar.gz

Download URL perchance-0.1.0.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e316bbda3def237320debfa5799d26634c2efa9a33fb3a3b7364267d4a9d1adb
BLAKE2b-256 checksum
How to use checksums
cb5aecbd19c439add5d9b42c64d672afbe124470ad80514ea2474349e13c8ee8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.13.1 Windows/11

Release files / perchance-0.1.0-py3-none-any.whl

Download URL perchance-0.1.0-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cca446620dff13a92a9c834122a9675dad209a37d35178ae7e177f24336cd2ff
BLAKE2b-256 checksum
How to use checksums
58593fc6b469692249889da2c3940bc4f04c1dd024e501cdff843f626f3e9eaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.13.1 Windows/11

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page