Image tagging API.
Reference:
Requirements:
- Python 3.12+
Clone the repository.
Download the model weights from JoyTag Hugging Face and save it to model/.
Create a virtual environment and install the dependencies.
Edit the configuration file config.toml:
token = "token" # Bearer token
port = 39917
host = "0.0.0.0"
threshold = 0.5
device = "cpu" # "cpu" or "cuda"Run the server:
python main.pyClient needs to add Authorization header with Bearer token.
{
"Authorization":"Bearer token"
}POST /predict: Predict tags from an image.
Upload an image file via multipart/form-data, with key file.
Response:
{
"predicted_tags": ["tag1", "tag2", "tag3"],
"scores": {
"tag1": 0.9,
"tag2": 0.8,
"tag3": 0.7
}
}GET /health: Health check.
Response:
{
"status": "healthy"
}