RepoReplicateReplicatepublished Apr 1, 2025seen 5d

replicate/replicate-model-classifier

TypeScript

Open original ↗

Captured source

source ↗

replicate/replicate-model-classifier

Description: An HTTP API to classify Replicate models into Hugging Face tasks using a language model.

Language: TypeScript

Stars: 0

Forks: 0

Open issues: 0

Created: 2025-04-01T21:53:15Z

Pushed: 2025-05-17T21:57:55Z

Default branch: main

Fork: no

Archived: no

README:

Replicate Model Classifier

An HTTP API to classify Replicate models into Hugging Face tasks using a language model.

Powered by:

  • Cloudflare Workers for hosting the HTTP API
  • Hono for authoring the HTTP API
  • Anthropic Claude 3.7 Sonnet for model classification
  • Replicate API for model metadata
  • Hugging Face Tasks for model task metadata
  • Cloudflare D1 for caching classifications

Repository: https://github.com/zeke/replicate-model-classifier

API

Base URL: https://replicate-model-classifier.ziki.workers.dev/

Classify a model

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 cache
  • Cache-Control: "public, max-age=315360000" (10 years)

Examples

View the prompt

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

View everything

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:

View all classifications

Get all cached model classifications:

GET /api/classifications

See /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…

Excerpt shown — open the source for the full document.

Notability

notability 5.0/10

New tool from Replicate, not a major release.