An HTTP API to classify Replicate models into Hugging Face tasks using a language model.
Powered by:
Repository: https://github.com/zeke/replicate-model-classifier
Base URL: https://replicate-model-classifier.ziki.workers.dev/
GET /api/models/:owner/:model
Returns a JSON object with the model classification. Responses are cached.
Cache Busting
To force a fresh classification and bypass the cache, add the bust=1
query parameter:
GET /api/models/:owner/:model?bust=1
This will skip the cache and trigger a new classification, updating the cache with the latest result.
Example:
/api/models/salesforce/blip?bust=1
Output Format
The response includes a classification
object with the following fields:
summary
: A short summary of what the model does in 10 words or less. Not a sales pitch.inputTypes
: An array of the types of inputs the model accepts, like "text", "image", "audio", etc.outputTypes
: An array of the types of outputs the model returns, like "text", "image", "audio", etc.task
: The Hugging Face task name the model performs.categories
: An array of 5 categories the model belongs to (e.g., "image", "audio", "diffusion").useCases
: An array of 10 use cases for the model. Each is a single sentence of 8 words or less.Example response:
{
"model": "salesforce/blip",
"classification": {
"summary": "Generate image captions and answer questions about images",
"inputTypes": ["image", "text"],
"outputTypes": ["text"],
"task": "visual-question-answering",
"categories": ["image", "captioning", "vision", "qa", "multimodal"],
"useCases": [
"Generate image captions for social media",
"Answer questions about medical images",
"Create alt text for accessibility",
"Analyze security camera footage",
"Describe artwork for museums",
"Generate product descriptions",
"Answer questions about diagrams",
"Create image-based quizzes",
"Analyze satellite imagery",
"Describe scenes in videos"
]
}
}
The response includes cache headers:
X-Cache
: Either "HIT" or "MISS" to indicate if the response came from cacheCache-Control
: "public, max-age=315360000" (10 years)Examples
To get a pretty-printed view of the prompt that was used to classify the model, add the prompt
query parameter:
GET /api/models/:owner/:model?prompt=1
Examples
It can be helpful to see all the data that goes into the model classification. You can see all the data by adding the debug
query parameter:
GET /api/models/:owner/:model?debug=1
Examples:
Get all cached model classifications:
GET /api/classifications
Returns a JSON object with all cached classifications:
{
"classifications": [
{
"model": "salesforce/blip",
"classification": {
"summary": "Generate image captions and answer questions about images",
"inputTypes": ["image", "text"],
"outputTypes": ["text"],
"task": "visual-question-answering",
"taskSummary": "Visual Question Answering is the task of answering open-ended questions based on an image. They output natural language responses to natural language questions.",
"useCases": [
"Generate image captions for social media",
"Answer questions about medical images",
"Create alt text for accessibility",
"Analyze security camera footage",
"Describe artwork for museums",
"Generate product descriptions",
"Answer questions about diagrams",
"Create image-based quizzes",
"Analyze satellite imagery",
"Describe scenes in videos"
]
},
"createdAt": "2024-04-29T04:00:00.000Z",
"updatedAt": "2024-04-29T04:00:00.000Z"
}
]
}
Get statistics about the classification cache:
GET /api/cache/stats
Returns a JSON object with cache statistics:
{
"total": 100,
"oldest": {
"model": "salesforce/blip",
"createdAt": "2024-04-29T04:00:00.000Z"
},
"newest": {
"model": "meta/meta-llama-3-8b-instruct",
"createdAt": "2024-04-29T05:00:00.000Z"
}
}
GET /api/tasks
See /api/tasks
GET /api/taskNames
See /api/taskNames
Each model classification includes a useCases
array that provides 10 specific use cases for the model. These use cases are generated by the language model based on the model's capabilities, input/output types, and task classification. Each use case is a concise, single-sentence description of a practical application of the model.
The use cases are designed to be:
This feature helps users quickly understand the potential applications of each model and find models that match their specific needs.