Skip to content

Latest commit

 

History

History
116 lines (105 loc) · 3.23 KB

CHANGELOG.md

File metadata and controls

116 lines (105 loc) · 3.23 KB

License Python Versions

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

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

CHANGELOG V1.0.0

+ Complete rewrite of code
+ Added GitObject (WIP)
+ Full update on ImageModel
+ Added negative prompt support
+ More params for classes
+ Better ImageModel.generate kwargs
+ Better ImageModel.generate method
+ Better ImageModel.genetate_batch kwargs
+ Better ImageModel.generate_batch method

NEW

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