Skip to content
Microsoft logo

resnet-50

Image ClassificationMicrosoftHosted

50 layers deep image classification CNN trained on more than 1M images from ImageNet

Model Info
More informationlink
Unit Pricing$0.0000025 per inference request

Usage

export interface Env {
AI: Ai;
}
export default {
async fetch(request, env): Promise<Response> {
const res = await fetch("https://cataas.com/cat");
const blob = await res.arrayBuffer();
const inputs = {
image: [...new Uint8Array(blob)],
};
const response = await env.AI.run(
"@cf/microsoft/resnet-50",
inputs
);
return new Response(JSON.stringify(response));
},
} satisfies ExportedHandler<Env>;

Parameters

Option 1
stringformat: binary
The image to classify

API Schemas (Raw)

Input
Output