This project provides a FastAPI-based web service that uses the FLUX.1 model to generate images from text prompts. The service is built on the modal.com.
To install the project, clone the repository and install the dependencies:
git clone [email protected]:FelippeChemello/modal_flux.1.git
cd modal_flux.1
pip install -r requirements.txt
To use the service, you need to have a modal.com and run the following command to set up modal.com CLI:
modal setup
on modal.com create a secret called flux.1-secret
and set the value of API_KEY
to a random string that will be used to authenticate the requests.
To run the service in development mode, use the following command:
modal serve app.py
To deploy the service, use the following command:
modal deploy app.py --name flux1
When deployed, modal.com will provide a URL for the service. The service has a single endpoint that accepts GET requests:
GET /?prompt=<text>&width=<width>&height=<height>
x-api-key: <API_KEY>
The prompt
parameter is the text prompt that will be used to generate the image. The width
and height
parameters are the dimensions of the image. The X-API-KEY
header must be set to the value of the API_KEY
secret created in modal.com.
The response will be a PNG image generated by the FLUX.1 model.