Skip to content

rubbrband/rubbrband

Repository files navigation

Rubbrband: Monitoring for Stable Diffusion

Rubbrband detects deformities in your images generated by Stable Diffusion at scale.

Installation

pip install rubbrband

Usage

import rubbrband
rubbrband.init("YOUR_API_KEY")
evals = rubbrband.eval("https://example.com/image.png", prompt="Prompt used to generate image")

Uploading Images to Rubbrband

  1. Using a URL
evals = rubbrband.eval(image="https://example.com/image.png", prompt="Prompt used to generate image")
  1. Using a PIL Image
from PIL import Image
evals = rubbrband.eval(image=Image.open("/path/to/image.png"), prompt="Prompt used to generate image")
  1. Using a path
evals = rubbrband.eval(image="/path/to/image.png", prompt="Prompt used to generate image")
  1. Using a context manager
with open("/path/to/image.png", "rb") as f:
    evals = rubbrband.eval(image=f, prompt="Prompt used to generate image")

Evaluation features

Rubbrband client library by default returns the is_deformed feature, which returns either True or False.

Other available features are ["nsfw"].

response = rubbrband.eval(
    "https://replicate.delivery/mgxm/85f53415-0dc7-4703-891f-1e6f912119ad/output.png",
    prompt="A woman wearing a strange hat",
    "features": ["nsfw"]
)

nsfw = response["nsfw_detected"]