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

Image Model

import pollinations

image_model: pollinations.ImageModel = pollinations.image(
    model = pollinations.image_default,
    seed = 0,
    width = 1024,
    height = 1024,
    enhance = False,
    nologo = False,
    private = False,
)

image_model.generate(
    prompt = "A black cat in a cyberpunk city.",
    negative = "Anime, cartoony, childish.",
    save = True,
    file = "image-output.png",
)

Text Model

import pollinations

text_model: pollinations.TextModel = pollinations.text(
    frequency_penalty = 0,
    presence_penalty = 0,
    temperature = 0.5,
    top_p = 1,
    model = pollinations.text_default,
    stream = True,
    contextual = True, # True: Holds conversation context up to 10. False: Has no conversation context
    system = "You are a polite AI Assistant named Pollinations! Use emojis and markdown as you wish."
)

text_model.generate(
    prompt="What is 1+1?",
    display=True
)
text_model.generate(
    prompt="Now add 10 to that.",
    display=True
)

Multi Model (Image & Text)

import pollinations

multi_model: pollinations.MultiModel = pollinations.multi(
    system = "You are a polite AI Assistant named Pollinations! Use emojis and markdown as you wish.",
    default = None, # None: AI will infer what model to use. Example: pollinations.turbo: Will default image model to turbo
    text_model = pollinations.text_default, # Safety fail measure incase of model errors in pollinations api.
    image_model = pollinations.image_default, # Safety fail measure incase of model errors in pollinations api.
)

multi_model.generate(
    "Hi",
    display=True,
    provide_details=False # Provides the details and objects of each generation
)
multi_model.generate(
    "Make an image of a black dog in a cyberpunk city.",
    display=True,
    provide_details=False
)
multi_model.generate(
    "Thanks.",
    display=True,
    provide_details=False
)

Smart Model (MultiModel up-to-date with time, dates, weather, and search) (Primitive Testing)

import pollinations

# Searching will not work unless you provide a serpapi api-key like this:
pollinations.keys(serpapi="your-key")

smart_model: pollinations.SmartModel = pollinations.smart(
    system="You are a polite AI Assistant named Pollinations! Use emojis and markdown as you wish."
)

smart_model.generate(
    prompt="Hi.",
    display=True,
    provide_details=False
)
smart_model.generate(
    prompt="What is the weather in london like?",
    display=True,
    provide_details=False
)
smart_model.generate(
    prompt="What's the latest news there as well?",
    display=True,
    provide_details=False
)
smart_model.generate(
    prompt="What time is it in New York City?",
    display=True,
    provide_details=False
)
smart_model.generate(
    prompt="Make an image of that at night, include city lights.",
    display=True,
    provide_details=False
)
smart_model.generate(
    prompt="Thanks.",
    display=True,
    provide_details=False
)

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

Uploaded Source

Built Distribution

pollinations.ai-2.0.1-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file pollinations.ai-2.0.1.tar.gz.

File metadata

  • Download URL: pollinations.ai-2.0.1.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for pollinations.ai-2.0.1.tar.gz
Algorithm Hash digest
SHA256 555876b0fb6b6796e4de807601d9c4a90dd21866da9671a5a9653fd04416b487
MD5 6bffe9c34bab0458b45b7a934dcc8c73
BLAKE2b-256 fe44d73daf93668ef6f7556727cc760f836594c3b706a6ac54b032d3f97f54d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pollinations.ai-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 717faca26670c853e1619cf45be60a1ee6f2e250d1b2d64c9ce7988467940485
MD5 dddd571ac64c7df7285434e2f92ebf1d
BLAKE2b-256 df507f2f5613d1119c4e2227e2d901f1b7871e319c4a7597c92441c3c03c543d

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