Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Updates to README from code review

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
  • Loading branch information
thealmightygrant and stevhliu authored Nov 13, 2024
1 parent a91feec commit be39807
Showing 1 changed file with 11 additions and 20 deletions.
31 changes: 11 additions & 20 deletions examples/server/README.md
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.

```

0 comments on commit be39807

Please sign in to comment.