Skip to content
Cloudflare Docs
HuggingFace logo

distilbert-sst-2-int8

Text ClassificationHuggingFace
@cf/huggingface/distilbert-sst-2-int8

Distilled BERT model that was finetuned on SST-2 for sentiment classification

Model Info
More informationlink
Unit Pricing$0.026 per M input tokens

Usage

export interface Env {
AI: Ai;
}
export default {
async fetch(request, env): Promise<Response> {
const response = await env.AI.run(
"@cf/huggingface/distilbert-sst-2-int8",
{
text: "This pizza is great!",
}
);
return Response.json(response);
},
} satisfies ExportedHandler<Env>;

Parameters

* indicates a required field

Input

  • text string required min 1

    The text that you want to classify

Output

  • items object

    • score number

      Confidence score indicating the likelihood that the text belongs to the specified label

    • label string

      The classification label assigned to the text (e.g., 'POSITIVE' or 'NEGATIVE')

API Schemas

The following schemas are based on JSON Schema

{
"type": "object",
"properties": {
"text": {
"type": "string",
"minLength": 1,
"description": "The text that you want to classify"
}
},
"required": [
"text"
]
}