-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates to README from code review Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
- Loading branch information
1 parent
a91feec
commit be39807
Showing
1 changed file
with
11 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,26 @@ | ||
|
||
## OpenAI Compatible `/v1/images/generations` Server | ||
# Create a server | ||
|
||
This is a concurrent, multithreaded solution for running a server that can generate images using the `diffusers` library. This examples uses the Stable Diffusion 3 pipeline, but you can use any pipeline that you would like by swapping out the model and pipeline to be the ones that you want to use. | ||
Diffusers' pipelines can be used as an inference engine for a server. It supports concurrent and multithreaded requests to generate images that may be requested by multiple users at the same time. | ||
|
||
### Installing Dependencies | ||
This guide will show you how to use the [`StableDiffusion3Pipeline`] in a server, but feel free to use any pipeline you want. | ||
|
||
|
||
Start by navigating to the `examples/server` folder and installing all the dependencies. | ||
|
||
Start by going to the base of the repo and installing it with: | ||
``py | ||
pip install . | ||
``` | ||
The pipeline can then have its dependencies installed with: | ||
```py | ||
pip install -f requirements.txt | ||
``` | ||
|
||
### Running the server | ||
|
||
This server can be run with: | ||
|
||
Launch the server with the following command. | ||
|
||
```py | ||
python server.py | ||
``` | ||
The server will be spun up at http://localhost:8000. You can `curl` this model with the following command: | ||
``` | ||
curl -X POST -H "Content-Type: application/json" --data '{"model": "something", "prompt": "a kitten in front of a fireplace"}' http://localhost:8000/v1/images/generations | ||
``` | ||
|
||
### Upgrading Dependencies | ||
|
||
If you need to upgrade some dependencies, you can do that with either [pip-tools](https://github.com/jazzband/pip-tools) or [uv](https://github.com/astral-sh/uv). With `uv`, this looks like: | ||
``` | ||
uv pip compile requirements.in -o requirements.txt | ||
If you need to upgrade some dependencies, you can use either [pip-tools](https://github.com/jazzband/pip-tools) or [uv](https://github.com/astral-sh/uv). For example, upgrade the dependencies with `uv` using the following command. | ||
|
||
``` | ||
|