README.md (1361B)
Rendered
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
Code
| # 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:
```shell
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](https://modal.com) for serverless GPU inference.
To deploy, run the following commands:
```shell
pip install modal
modal setup
modal deploy modal_app.py
```
# Setup
> [!NOTE]
> For [Nix](https://nixos.org/) users, a [Flake](./flake.nix) for the development shell is provided
## Models
Download all the models from [here](https://drive.google.com/drive/folders/143A296pgkTiUGqffE4xG8ADPPEGOY-W2) and place them inside this directory
## Environment Variables
Ensure that a [`.env`](./.env) file is present in this directory containing the following contents:
```dotenv
FAL_KEY=<Fal.ai API Key>
SHARED_SECRET_KEY=<Base64 Security Key>
```
> [!CAUTION]
> You must update the root [`.env`](../.env) file for the app to recognize the deployed backend
|