Skip to main content

UI tool to help you generate art (and experiment) with multimodal (text, image) AI models (stable diffusion)

Project description

Peacasso

Open In Colab

Peacasso [Beta] is a UI tool to help you generate art (and experiment) with multimodal (text, image) AI models (stable diffusion). This project is still in development (see roadmap below).

Why Use Peacasso?

Because you deserve a nice UI and great workflow that makes exploring stable diffusion models fun! But seriously, here are a few things that make Peacasson interesting:

  • Easy installation. Instead of cobbling together command line scripts, Peacasso provides a pip install flow and a UI that supports a set of curated default operations.
  • UI with good defaults. The current implementation of Peacasso provides a UI for basic operations - text and image based prompting (+ inpainting), remixing generated images as prompts, model parameter selection, image download. Also covers the little things .. like light and dark mode.
  • Python API. While the UI is the focus here, there is an underlying python api which will bake in experimentation features (e.g. saving intermediate images in the sampling loop, exploring model explanations etc. . see roadmap below).

Clearly, Peacasso (UI) might not be for those interested in low level code.

Requirements and Installation

  • Step 1: Access to Weights via HuggingFace

    Access to the diffusion model weights requires a HuggingFace model account and access token. Please create an account at huggingface.co, get an access token and agree to the model terms here. Next, create a HF_API_TOKEN environment variable containing your token. export HF_API_TOKEN=your_token. Note that the first time you run peacasso, the weights for the SD model are cached locally on your machine. In theory, you can download the weights, and run peacasso by pointing to the folder with the weights.

  • Step 2: Verify Environment - Pythong 3.7+ and CUDA Setup and verify that your python environment is python 3.7 or higher (preferably, use Conda). Also verify that you have CUDA installed correctly (torch.cuda.is_available() is true) and your GPU has about 7GB of VRAM memory.

Once requirements are met, run the following command to install the library:

pip install peacasso

Don't have a GPU, you can still use the python api and UI in a colab notebook. See this colab notebook for more details.

Usage - UI and Python API

You can use the library from the ui by running the following command:

peacasso ui  --port=8080

Then navigate to http://localhost:8080/ in your browser.

You can also use the python api by running the following command:

import os
from dotenv import load_dotenv
from peacasso.generator import ImageGenerator
from peacasso.datamodel import GeneratorConfig

token = os.environ.get("HF_API_TOKEN")
gen = ImageGenerator(token=token, model="CompVis/stable-diffusion-v1-4")
prompt = "A sea lion wandering the streets of post apocalyptic London"

prompt_config = GeneratorConfig(
    prompt=prompt,
    num_images=3,
    width=512,
    height=512,
    guidance_scale=7.5,
    num_inference_steps=50,
    mode="prompt",  # prompt, image
    return_intermediates=True, # return intermediate images in the generate dict response
)

result = gen.generate(prompt_config)
for i, image in enumerate(result["images"]):
    image.save(f"image_{i}.png")

Features and Road Map

  • Command line interface
  • UI Features. Query models with multiple parametrs
    • Text prompting (text2img)
    • Image based prompting (img2img)
    • Inpainting (img2img)
    • Editor (for outpainting)
    • Latent space exploration
    • Model explanations
  • Experimentation tools
    • Save intermediate images in the sampling loop
    • Prompt recommendation tools
    • Model explanations
    • Curation/sharing experiment results
    • Defined Workflows (e.g., tiles, composition etc.)

Acknowledgement

This work builds on the stable diffusion model and code is adapted from the HuggingFace implementation. Please note the - CreativeML Open RAIL-M license associated with the stable diffusion model.

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

Peacasso-0.0.14a0.tar.gz (29.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Peacasso-0.0.14a0-py3-none-any.whl (3.9 MB view details)

Uploaded Python 3

File details

Details for the file Peacasso-0.0.14a0.tar.gz.

File metadata

  • Download URL: Peacasso-0.0.14a0.tar.gz
  • Upload date:
  • Size: 29.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for Peacasso-0.0.14a0.tar.gz
Algorithm Hash digest
SHA256 775d8ede59d41c442980a9a979c8b9c51a442089142cd8048ff8ce590b6a3d65
MD5 5d3d45049ca27485f5c4d10984557847
BLAKE2b-256 cb9474e869f4825eb58ffdd7cdad9f957d821f14729e78ed8daf012d806c837c

See more details on using hashes here.

File details

Details for the file Peacasso-0.0.14a0-py3-none-any.whl.

File metadata

  • Download URL: Peacasso-0.0.14a0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.12

File hashes

Hashes for Peacasso-0.0.14a0-py3-none-any.whl
Algorithm Hash digest
SHA256 5efc0e7af7c79e0a6b773196cca8f496ef0b320de6b4251884131c7ea300d29c
MD5 f05fee0389ad6883ac478b02a6b9629a
BLAKE2b-256 ac817c43d04bd0ce670ddadc71f0f1404d649cf22f89383253bfa01f83954bf7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page