Dockerized FastAPI wrapper around the impressive recognize-anything image recognition models.
All model weights, etc are baked into the docker image rather than fetched at runtime.
This means it's possible to run this image without granting it internet access, and
hopefully means it will continue to work in 6 months time. You can verify this by
running the image with --net none and using docker exec trying:
curl --verbose -F file=@/opt/app/recognize_anything/images/demo/demo1.jpg localhost:8000/Caveat, the image is huge (~20gb, of which ~13gb is weights, ~6gb pip dependencies) as a result - though it could probably be slimmed down a bit.
This repository is published to dockerhub. You can run it like so
docker run -it --rm --gpus all -p 8000:8000 mnahkies/recognize-anything-apiNote: this assumes you have
the nvidia container runtime
installed, but omitting --gpus all should still work fine running inference on the CPU.
Then make requests using your client of choice, eg:
curl --verbose -F file=@/path/to/image.jpg localhost:8000/Pre-requisites:
- Docker/equivalent installed and running
Clone this repository with submodules:
git clone --recurse-submodulesThen run:
./bin/docker-build.sh`
Simply run:
./bin/docker-run.shThen you can make requests like:
curl --verbose -F file=@/path/to/image.jpg localhost:8000/You can choose which model is used by setting the MODEL_NAME environment variable to one of:
ram_plus(default)ramtag2text
See ./server.py for other options.
See ./LICENSE and ./recognize_anything/NOTICE.txt
This is a very scrappy project that I created to experiment with https://github.com/xinyu1205/recognize-anything and there is plenty of scope for improvement!
PR's to improve the configurability, packaging, efficiency, etc are welcome.