pollinations.ai | Image Generation
Project description
pollinations.ai - Image Generation
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pollinations-1.0.1.tar.gz
(18.7 kB
view details)
Built Distribution
File details
Details for the file pollinations-1.0.1.tar.gz
.
File metadata
- Download URL: pollinations-1.0.1.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 285ce3a87678a467a64c0c8aa5b16e795de0a12865ecb0f0ac423d4c071bf578 |
|
MD5 | 8ceff367dc28426d1d616a6f963c3a85 |
|
BLAKE2b-256 | 3b4e91975c9bc7c341c559a78d3f353753835b69acfdef1ab718d5d070a60c6d |
File details
Details for the file pollinations-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: pollinations-1.0.1-py3-none-any.whl
- Upload date:
- Size: 19.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfae973dbd7b956b0e8c87dd3be8dde9b5bd63ce6f95da50208d06beece81323 |
|
MD5 | d52c1e04ad8463b408fbab93316aa1dc |
|
BLAKE2b-256 | 80f7a67d37f161b7d94a9bd0b97803f88d7141dd682fd9bb83f7c073fc4b840c |