git clone https://github.com/ashleykleynhans/runpod-worker-instantid.git
cd runpod-worker-instantid
python3 -m venv venv
source venv/bin/activate
cd src
pip3 install --no-cache-dir torch==2.0.1 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pip3 install --no-cache-dir xformers==0.0.22 runpod
pip3 install -r requirements.txt
python3 download_checkpoints.py
Use --rp_serve_api
command line argument to serve the API locally.
python3 -u rp_handler.py --rp_serve_api
NOTE: You need to keep the RunPod Handler API running in order to run the tests, so open a new terminal window to run the tests.
You can either overwrite the images in the data
directory with your
own source and target files, or alternatively, you can edit the
scripts in the tests
directory to reference the source and target
images somewhere else on your system.
If you have added your RUNPOD_API_KEY
and
RUNPOD_ENDPOINT_ID
to the .env
file within
this directory, you should first comment them
out before attempting to test locally. If
the .env file exists and the values are provided,
the tests will attempt to send the requests to
your RunPod endpoint instead of running locally.
- Ensure that the RunPod Handler API is still running.
- Change directory to the
tests
directory and run one of the scripts, for example:
cd tests
python3 generate.py
- This will display the HTTP status code and the filename of the output image, for example:
Status code: 200
Saving image: 792a7e9f-9c36-4d35-b408-0d45d8e2bbcb.jpg
You can then open the output image (in this case
792a7e9f-9c36-4d35-b408-0d45d8e2bbcb.jpg
) to view the
results.
You obviously need to edit the payload within the script to achieve the desired results.