跳转到内容
本站为社区维护的非官方中文翻译,与 Cloudflare, Inc. 无关联。本站不提供账户登录,请勿在任何非官方站点输入您的 Cloudflare 账户信息。官方文档:developers.cloudflare.com
Meta logo

bart-large-cnn

Beta

Summarization • Meta

查看 MarkdownAgent 设置
  • Cloudflare-hosted
  • Deprecated

BART 是一个 Transformer 编码器-解码器(seq2seq)模型,包含一个双向(类 BERT)编码器和一个自回归(类 GPT)解码器。您可以使用此模型进行文本摘要。

模型信息
已弃用2026/5/30
Beta是
单位定价$0.00 per M input tokens

用法


export interface Env {
  AI: Ai;
}

export default {
  async fetch(request, env): Promise<Response> {
    const response = await env.AI.run("@cf/facebook/bart-large-cnn", {
      input_text: "Workers AI allows you to run machine learning models, on the Cloudflare network, from your own code – whether that be from Workers, Pages, or anywhere via the Cloudflare API. With the launch of Workers AI, Cloudflare is slowly rolling out GPUs to its global network. This enables you to build and deploy ambitious AI applications that run near your users, wherever they are.",
      max_length: 14
    });
    return Response.json(response);
  },
} satisfies ExportedHandler<Env>;

curl https://api.cloudflare.com/client/v4/accounts/{cf_account_id}/ai/run/@cf/facebook/bart-large-cnn \
  -H "Authorization: Bearer {cf_api_token}" \
  -d '{
    "input_text": "Workers AI allows you to run machine learning models, on the Cloudflare network, from your own code – whether that be from Workers, Pages, or anywhere via the Cloudflare API. With the launch of Workers AI, Cloudflare is slowly rolling out GPUs to its global network. This enables you to build and deploy ambitious AI applications that run near your users, wherever they are.",
    "max_length": 14
  }'

参数

input_text
stringrequiredminLength: 1您希望模型进行摘要的文本
max_length
integerdefault: 1024生成摘要的最大长度(以 token 计)
summary
string输入文本的摘要版本

API schema(原始)

输入
输出

这篇文档对您有帮助吗?