jfischoff / text-to-image

A single API for text-to-image, built on fal that supports all Stable Diffusion variants

Home Page:https://fal.ai/models/sd-loras

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fal-ai/text-to-image

tl;dr A single API for text-to-image, built on fal that supports all Stable Diffusion variants, checkpoints and LoRAs from HuggingFace (🤗) and CivitAI.

To start using an already deployed endpoint check out the API docs here.

At a glance:

  • A single text-to-image API that can scale to 100s of GPUs automatically
  • Supports all versions of Stable Diffusion (1.4, 1.5, 2.0, 2.1 and XL)
  • Pass any finetuned base model (RealisticVision etc) as a URL from HuggingFace or CivitAI
  • Pass any LoRA weights from HuggingFace or CivitAI
  • Supports multiple LoRA loading
  • Built on the latest high-performance stack: PyTorch 2.0, diffusers, Flash Attention 2.0, LoRA fusing / unfusing
  • Minimal cold starts
  • Pay by the second (when deployed on fal)

Background

fal text-to-image originally started as a simple reference application demonstrating the capabilities of our serverless Python cloud fal with a text-to-image example. Our goal was to provide a high-performance LoRA loading/unloading example on top of arbitrary Stable Diffusion models. From there, we went on a deep rabbit hole and made significant contributions to the amazing diffusers library, supporting many different LoRA variants and other optimizations.

Today, text-to-image is a very capable application serving millions of users as a single API for high-performance inference with extensive LoRA support, made possible by our serverless Python runtime, fal. We wanted to open source the repo for the community to be able to look under the hood, tinker, send us feedback and feature requests.

If you want to just try this app from our simple UI, go to fal.ai's model playground! There, you will also see instructions on how to use the API.

To deploy this application on fal on your own, check out the fal docs!

Join our Discord community and help us shape the direction of this project!

Examples

You can start using the text-to-image service immediately by signing into fal.ai and downloading fal package from PyPI!

$ pip install fal
$ fal auth login

Once you signed in, you are ready to use the text-to-image service!

import fal

result = fal.apps.run("110602490-lora", arguments={
    "model_name": "stabilityai/stable-diffusion-xl-base-1.0",
    "prompt": "a cute cat",
})
print(result["images"][0]["url"])

About

A single API for text-to-image, built on fal that supports all Stable Diffusion variants

https://fal.ai/models/sd-loras


Languages

Language:Python 100.0%