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
# Linux/macOS
python3 -m pip install -U pollinations.ai
# Windows
py -3 -m pip install -U pollinations.ai
Simple Examples
import pollinations.ai as ai
model: ai.Image = ai.Image()
image: ai.ImageObject = model.generate(
prompt='lion feasting on prey',
# model...width...height...seed...
nologo=False,
).save()
# >>> lion feasting on prey https://image.pollinations.ai/prompt/lion%20feasting%20on%20prey?model...width...height...seed...&nologo=true
@abc.resource(deprecated=False)
def generate(
self,
prompt: str,
*args,
model: str = None, width: int = 1024, height: int = 1024, seed: int = None, nologo: bool = False,
**kwargs,
) -> str:
DEPRECATED > Chatting with text generative ai model:
# import pollinations.ai as ai
# model: ai.Text = ai.Text()
# response: str = model.chat(prompt='What is the meaning of life?')
Setting model filter:
import pollinations.ai as ai
image_generator: ai.Image = ai.Image()
image_generator.set_filter(ai.BANNED_WORDS)
# If any word from a prompt is in the filter it will return an exception.
Batch sample and generation:
import pollinations.ai as ai
batch: list = ai.sample_batch(size=5)
image_generator: ai.Image = ai.Image()
image_generator.generate_batch(prompts=batch, save=True) # OPTIONAL: path # OPTIONAL: naming = 'counter' | naming = 'prompt'
# image_generator.generate_batch(prompts=batch, save=True, path='somefolder', naming='prompt')
@abc.resource(deprecated=False)
def generate_batch(
self,
prompts: list,
save: bool = False,
path: str = None,
naming: str = "counter",
*args,
model: str = None, width: int = 1024, height: int = 1024, seed: int = None, nologo: bool = False,
**kwargs,
) -> list:
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-0.5.1.tar.gz
(18.7 kB
view details)
Built Distribution
File details
Details for the file pollinations-0.5.1.tar.gz
.
File metadata
- Download URL: pollinations-0.5.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 | b72d29323aa783b96740429197ac46abe885690565589e443d7fa04cf60fc3d9 |
|
MD5 | 113d132c7f7113e5de5832fd8a6e3fe7 |
|
BLAKE2b-256 | 010f925032a0bf88212198546447060c50cde16c26acf21644eea0b47391db1e |
File details
Details for the file pollinations-0.5.1-py3-none-any.whl
.
File metadata
- Download URL: pollinations-0.5.1-py3-none-any.whl
- Upload date:
- Size: 18.9 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 | e5dfaba6a60543a7cb1cef3b3d3e2f61fbd8972230cca7f95cc634dfb7935a56 |
|
MD5 | f038f5ea39d425c17f3566617b7f387d |
|
BLAKE2b-256 | 001d59b82234818480716735b64b2d812bc5547098ed88b24544462f335da2ce |