Backend

This project provides a unified AI backend for image generation, inpainting, background removal, and captioning. It supports two modes of operation:

1. Local Server (index.py)

Runs on your local machine.

Important

Requires Cuda-enabled NVIDIA GPU
Might require additional intervention for PyTorch installation

To run backend locally, run the following commands:

pip install -r requirements.txt
python ./index.py

Note

Tested on Python 3.11, compatibility with other versions is not guaranteed

2. Cloud Server (modal_app.py)

Deploys to Modal.com for serverless GPU inference.

To deploy, run the following commands:

pip install modal
modal setup
modal deploy modal_app.py

Setup

Note

For Nix users, a Flake for the development shell is provided

Models

Download all the models from here and place them inside this directory

Environment Variables

Ensure that a .env file is present in this directory containing the following contents:

FAL_KEY=<Fal.ai API Key>
SHARED_SECRET_KEY=<Base64 Security Key>

Caution

You must update the root .env file for the app to recognize the deployed backend