Skip to main content

pollinations.ai | Image Generation

Project description

pollinations.ai - Image Generation

License Python Versions

pollinations.ai: (https://pollinations.ai/)

This is a WRAPPER designed for easy text-image generation.

Installing

pip install -U pollinations
pip install -U pollinations.ai

# Linux/macOS
python3 -m pip install -U pollinations
python3 -m pip install -U pollinations.ai

# Windows
py -3 -m pip install -U pollinations
py -3 -m pip install -U pollinations.ai

Simple Examples

import pollinations.ai as ai

# Version 1
model: ai.Image = ai.Image()
image: ai.ImageObject = model.generate(
      prompt="A cat playing with a ball",
      # negative...width...height...height...seed...model...nologo
)
image.save("cat_playing_with_ball.png")
print(image)
# -------------------------------------------- #
# Version 2
class Model(ai.Image):
      params: dict = {
            "prompt": "cat in space",
            #negative...width...height...height...seed...model...nologo
      }

model: ai.Image = Model()
model.generate().save()
def generate(
        self,
        prompt: str = "...",
        *args,
        negative: str = "",
        width: int = 1024,
        height: int = 1024,
        seed: int = 0,
        model: str = None,
        nologo: bool = None,
        **kwargs,
    ) -> types.ImageObject:

Batch Generation

import pollinations.ai as ai

# Version 1
model: ai.Image = ai.Image()
prompts: list = ["cat in space", "dog in space"]
images: list[ai.ImageObject] = model.generate_batch(prompts, save=True, path="my/path/here")
# -------------------------------------------- #
# Version 2
class Model(ai.Image):
      params: dict = {
            "prompt": ["lion in space", "dog in space"]
      }

model: ai.Image = Model()
model.generate_batch(save=True, path="my/path/here")
def generate_batch(
        self,
        prompts: list = ["..."],
        negative: list = ["..."],
        save: bool = False,
        path: str = "pollinations-Image.png",
        naming: str = "counter",
        *args,
        model: str = None,
        width: int = 1024,
        height: int = 1024,
        seed: int = 0,
        nologo: bool = False,
        **kwargs,
    ) -> list[types.ImageObject]:

Setting model filter

import pollinations.ai as ai

model: ai.Image = ai.Image()
model.set_filter(ai.filtered)
model.set_filter(["custom", "words", "here"])

# If any word from a prompt is in the filter it will return an exception.

Links

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

pollinations_ai-1.0.2.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

pollinations.ai-1.0.2-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

Details for the file pollinations_ai-1.0.2.tar.gz.

File metadata

  • Download URL: pollinations_ai-1.0.2.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for pollinations_ai-1.0.2.tar.gz
Algorithm Hash digest
SHA256 525512fd327db1000eee991829aec19a13fb477fe4d60c8b39632184d5b22220
MD5 f5de67436f63d01a1cc3cca5b132b8b9
BLAKE2b-256 5204d10dc5a8e9dbfc56263163a691b4882aad52e2e567f11e74a753da702374

See more details on using hashes here.

File details

Details for the file pollinations.ai-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pollinations.ai-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 600a646576ebef8b9db1875553f2ae44b3e29894f6070d962f7cda5b0cc5c659
MD5 d8203b2715c014069e020d6ec267b16a
BLAKE2b-256 cc681f8dd1bb160417c34a01772bc8f5ac9fa05c3b3d5082c70c31e28cebb43e

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