The refactored code for inference of PyTorch implementation of StarGAN v2 wrapped into Flask-API.
You can build a Docker image to run the application with the WSGI server (Gunicorn). For details check this branch.
Otherwise, you need firstly load models weights:
bash download.sh
Then install packages:
pip install -r requirements.txt
Then run the following to launch the development server::
python app.py
And finally check: http://127.0.0.1:5000/
There is a single /Interpolate endpoint that expects POST method with JSON body with keys:
- src: (file) Source image (Note that it should be cropped similar to examples from CelebA-HQ or AFHQ dataset)
- ref: (file) Reference image with the same requirement
- label: (string) The label of the target image. If you are interested in CelebA-HQ format, there ate two possible labels: "male", "female", if you are interested in AFHQ format, available next labels: "cat", "dog", "wild"
The response is a file as src and ref
Example of response: