Python 3 API using OpenAI's CLIP model, generate top 5 image text descriptions
- Install dependencies from
requirements.txt
e.g.pip install -r requirements.txt
- Start the FastAPI server with
fastapi dev main.py
,dev
indicated running in development mode - By default server is exposed on port 8000 e.g.
curl 'http://127.0.0.1:8000'
, there's a Hello World test endpoint an optional name parameter to test 'curl 'http://127.0.0.1:8000/test?name=Lorena'' - To access docs use
http://127.0.0.1:8000/docs
- To generate description an example curl is provided here:
curl \
-X POST \
-H "Content-Type: multipart/form-data" \
-F "image=@/lorena-selfie.png" \
http://localhost:8000/description
- CLIP Huggable API Docs
- Python example tutorial
- Python example linking images with text