Whisper-large-v3-turbo với Cloudflare Workers AI Whisper-large-v3-turbo with Cloudflare Workers AI ហ្វេសប៊ូតុង-v3-turbo ជាមួយ Cloudflare Workers AI
Hướng dẫn chi tiết đồng bộ từ docs Cloudflare — mỗi section có backlink tới đúng vị trí trên trang gốc. Detailed guide synced from Cloudflare docs — each section links to the matching anchor on the official page. មគ្គុទ្ទេសក៍លម្អិតធ្វើសមកាលពី docs Cloudflare — ផ្នែកនីមួយៗមានតំណទៅទីតាំងត្រូវគ្នានៅទំព័រផ្លូវការ។
← Danh mục ← Catalog ← បញ្ជីGiải thích nhanh Quick context បរិបទរហ័ស
Thuộc Developer Platform — thực hành triển khai code, API và dữ liệu trên edge/serverless. Tutorial «Whisper-large-v3-turbo với Cloudflare Workers AI» giúp bạn làm quen luồng triển khai thật — phù hợp đọc trước khi mở tài liệu gốc tiếng Anh. Docs gốc chia khoảng 4 bước chính; bản tóm tắt dưới đây giúp bạn nắm khung trước khi làm theo từng lệnh.
Learn how to transcribe large audio files using Workers AI.
តើធ្វើដូចម្តេចដើម្បីធ្វើតេស្តឯកសារអូឌីយ៉ូធំដោយប្រើ Workers AI?
Lưu ý Note ចំណាំ
Lưu ý trước khi làm Notes before you start ចំណាំមុនពេលចាប់ផ្តើម
- Đây là bản tóm tắt trên Orange Cloud Learning Hub — không thay thế tài liệu chính thức.
- Luôn mở liên kết «Tài liệu gốc» bên dưới khi cần lệnh CLI, snippet code và ảnh minh họa đầy đủ.
- Cần tài khoản Cloudflare, Wrangler CLI và (thường) hoàn thành hướng dẫn Get started của Workers/Pages.
- Docs Cloudflare cập nhật thường xuyên — đối chiếu ngày «Rà soát lần cuối» trên trang gốc khi triển khai production.
- This is a summary on Orange Cloud Learning Hub — it does not replace the official documentation.
- Open the Official docs link below for CLI commands, code snippets, and full screenshots.
- Requires a Cloudflare account, Wrangler CLI, and (typically) completing the Workers/Pages Get started guide.
- Cloudflare docs change frequently — verify the Last reviewed date on the official page before production use.
- នេះគឺជាការបញ្ជាក់អំពី Orange Cloud Learning Hub — វាគឺជាការផ្លាស់ប្តូរនៃឯកសារផ្លូវការ។
- ចុចតំណភ្ជាប់ Docs Official នៅខាងក្រោមសម្រាប់ការបញ្ជា CLI, សៀវភៅកូដនិងរូបថតពេញលេញ។
- តម្រូវឱ្យមានគណនី Cloudflare, Wrangler CLI និង (ប្រហែលជា) ការបញ្ចប់គណនី Workers/Pages Get started ។
- Cloudflare បានផ្លាស់ប្តូរជាធម្មតានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅពេលវេលានៅ។
Tài liệu gốc — rà soát lần cuối: about 1 year ago Official docs — last reviewed: about 1 year ago ឯកសារផ្លូវការ — ពិនិត្យចុងក្រោយ: about 1 year ago
Overview Overview Overview
Phần «Tổng quan» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "Overview" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «Overview» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
- Transcribe large audio files: Sử dụng mô hình Whisper-large-v3-turbo từ Cloudflare Workers AI để thực hiện nhận dạng giọng nói tự động (ASR) hoặc dịch.
- Handle large files: Chia tệp âm thanh lớn thành các mảnh nhỏ hơn để xử lý, giúp vượt qua hạn chế về bộ nhớ và thời gian thực hiện.
- Deploy using Cloudflare Workers: Tạo một đường ống biên dịch có thể mở rộng, chậm trễ thấp trong môi trường không có máy chủ.
- Transcribe large audio files: Use the Whisper-large-v3-turbo model from Cloudflare Workers AI to perform automatic speech recognition (ASR) or translation.
- Handle large files: Split large audio files into smaller chunks for processing, which helps overcome memory and execution time limitations.
- Deploy using Cloudflare Workers: Create a scalable, low‑latency transcription pipeline in a serverless environment.
- Transcribe large audio files: ប្រើម៉ូដែល Whisper-large-v3-turbo ពី Cloudflare Workers AI ដើម្បីធ្វើការអនុម័តការសរសេរដោយស្វ័យប្រវត្តិ (ASR) ឬការបម្លែង។
- Handle large files: ការផ្លាស់ប្តូរឯកសារអូឌីយ៉ូធំទូលំទូលាយទៅក្នុងផ្លាស់ប្តូរទំហំទូលំទូលំទូលំទូលំទូលំទូលំទូលំទូលំទូលំទូលំទូលំទូលំទូលំទូលំទូលំទូលំទូលំទូលំទូលំទូលាយ។
- Deploy using Cloudflare Workers: បានបង្កើត pipeline transcription ដែលអាចកាត់បន្ថយទំហំទូលាយនៅក្នុងបរិស្ថានដែលមិនមានសេវាកម្ម។
Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs) តំណពាក់ព័ន្ធ (docs Cloudflare)
1: Tạo một dự án mới Cloudflare Worker 1: Create a new Cloudflare Worker project 1: បង្កើតគម្រោងការងារថ្មី Cloudflare
Phần «1: Create mới Cloudflare Worker dự án» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "1: Create a new Cloudflare Worker project" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «1: បង្កើតគម្រោងការងារថ្មី Cloudflare» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
- Đăng ký cho một Cloudflare account ↗.
- Cài đặt Node.js ↗
- Sign up for a Cloudflare account ↗.
- Install Node.js ↗.
- សូមចុះឈ្មោះសម្រាប់ Cloudflare account ↗ ។
- ទាញយក Node.js ↗ ។
16.17.0 hoặc mới hơn.16.17.0 or later.16.17.0 ឬបន្ទាប់មក។create-cloudflare CLI (C3). C3 ↗ là một công cụ dòng lệnh được thiết kế để giúp bạn thiết lập và triển khai các ứng dụng mới để Cloudflare.create-cloudflare CLI (C3). C3 ↗ is a command-line tool designed to help you set up and deploy new applications to Cloudflare.create-cloudflare CLI (C3) ។ C3 ↗ គឺជាឧបករណ៍បន្ទាត់គោលបំណងដែលត្រូវបានរចនាឡើងដើម្បីជួយអ្នកបង្កើតនិងដំឡើងកម្មវិធីថ្មីទៅ Cloudflare ។whisper-tutorial bằng cách chạy:whisper-tutorial by running:whisper-tutorial ដោយធ្វើការ:npm create cloudflare@latest -- whisper-tutorial yarn create cloudflare whisper-tutorial pnpm create cloudflare@latest whisper-tutorial npm create cloudflare@latest sẽ nhắc bạn cài đặt create-cloudflare package ↗, và dẫn bạn qua thiết lập. C3 cũng sẽ cài đặt Wrangler, nền tảng phát triển Cloudflare CLI.npm create cloudflare@latest will prompt you to install the create-cloudflare package ↗, and lead you through setup. C3 will also install Wrangler, the Cloudflare Developer Platform CLI.npm create cloudflare@latest នឹងបង្វិលអ្នកដើម្បីដំឡើង create-cloudflare package ↗ និងនាំអ្នកតាមរយៈការដំឡើង។ C3 នឹងដំឡើង Wrangler, Cloudflare ប្លាស្ទិចអ្នកអភិវឌ្ឍន៍ CLI ។- Đối với Bạn muốn bắt đầu với gì?, chọn
Hello World example. - Đối với bạn muốn sử dụng mẫu nào?, chọn
Worker only. - Đối với Ngôn ngữ nào bạn muốn sử dụng?, chọn
TypeScript. - Đối với Do you want to use git for version control?, chọn
Yes. - Đối với Bạn muốn triển khai ứng dụng của mình?, chọn
No(chúng tôi sẽ thực hiện một số thay đổi trước khi triển khai).
- For What would you like to start with?, choose
Hello World example. - For Which template would you like to use?, choose
Worker only. - For Which language do you want to use?, choose
TypeScript. - For Do you want to use git for version control?, choose
Yes. - For Do you want to deploy your application?, choose
No(we will be making some changes before deploying).
- សម្រាប់ តើអ្នកចង់ចាប់ផ្តើមជាមួយអ្វី?, ជ្រើស
Hello World example។ - សម្រាប់គំរូ តើអ្នកចង់ប្រើគំរូណាមួយ?, ជ្រើស
Worker only។ - សម្រាប់ តើអ្នកចង់ប្រើភាសាណាមួយ?, ជ្រើស
TypeScript។ - សម្រាប់ តើអ្នកចង់ប្រើ git សម្រាប់ការគ្រប់គ្រងកំណែ?, ជ្រើស
Yes។ - សម្រាប់ តើអ្នកចង់ដំឡើងកម្មវិធីរបស់អ្នក?, ជ្រើស
No(យើងនឹងធ្វើការផ្លាស់ប្តូរមួយចំនួនមុនពេលដំឡើង) ។
whisper-tutorial mới. Thư mục whisper-tutorial sẽ bao gồm:whisper-tutorial directory. Your new whisper-tutorial directory will include:whisper-tutorial ថ្មី។ សៀវភៅថ្មីរបស់អ្នក whisper-tutorial នឹងមាន:- A
"Hello World"Worker tạisrc/index.ts. - Một tập tin cấu hình wrangler.jsonc.
- A
"Hello World"Worker atsrc/index.ts. - A wrangler.jsonc configuration file.
- ការ
"Hello World"Worker នៅsrc/index.ts។ - ទាញយកឯកសារ wrangler.jsonc ។
cd whisper-tutorial Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs) តំណពាក់ព័ន្ធ (docs Cloudflare)
2.Đối với Kết nối nhân viên của bạn với Workers AI 2. Connect your Worker to Workers AI 2 ។ ទូរស័ព្ទដៃរបស់អ្នកទៅ Workers AI
Phần «Kết nối your Worker to Workers AI» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "2. Connect your Worker to Workers AI" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «2 ។ ទូរស័ព្ទដៃរបស់អ្នកទៅ Workers AI» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
{
"ai": {
"binding": "AI"
}
} [ai]
binding = "AI" Liên kết liên quan (docs Cloudflare) Related links (Cloudflare docs) តំណពាក់ព័ន្ធ (docs Cloudflare)
3 Cái Cấu hình Wrangler 3. Configure Wrangler 3 ។ ការកំណត់ Wrangler
Phần «Cấu hình Wrangler» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "3. Configure Wrangler" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «3 ។ ការកំណត់ Wrangler» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
{
"compatibility_flags": [
"nodejs_compat"
],
// Set this to today's date
"compatibility_date": "2026-06-10"
} compatibility_flags = [ "nodejs_compat" ]
# Set this to today's date
compatibility_date = "2026-06-10" Bốn Xử lý các tập tin âm thanh lớn với chunking 4. Handle large audio files with chunking 4 ។ ការដោះស្រាយឯកសារអូឌីយ៉ូធំជាមួយ Chunking
Phần «Xử lý large audio files với chunking» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "4. Handle large audio files with chunking" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «4 ។ ការដោះស្រាយឯកសារអូឌីយ៉ូធំជាមួយ Chunking» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
src/index.ts của bạn bằng mã tích hợp sau. Mẫu này cho thấy cách:src/index.ts file with the following integrated code. This sample demonstrates how to:src/index.ts របស់អ្នកជាមួយនឹងកូដរួមបញ្ចូលដូចខាងក្រោម។ ការគំរូនេះបង្ហាញពីរបៀបដើម្បី:import { Buffer } from "node:buffer";
import type { Ai } from "workers-ai";
export interface Env {
AI: Ai;
// If needed, add your KV namespace for storing transcripts.
// MY_KV_NAMESPACE: KVNamespace;
}
/**
* Fetches the audio file from the provided URL and splits it into chunks.
* This function explicitly follows redirects.
*
* @param audioUrl - The URL of the audio file.
* @returns An array of ArrayBuffers, each representing a chunk of the audio.
*/
async function getAudioChunks(audioUrl: string): Promise<ArrayBuffer[]> {
const response = await fetch(audioUrl, { redirect: "follow" });
if (!response.ok) {
throw new Error(`Failed to fetch audio: ${response.status}`);
}
const arrayBuffer = await response.arrayBuffer();
// Example: Split the audio into 1MB chunks.
const chunkSize = 1024 * 1024; // 1MB
const chunks: ArrayBuffer[] = [];
for (let i = 0; i < arrayBuffer.byteLength; i += chunkSize) {
const chunk = arrayBuffer.slice(i, i + chunkSize);
chunks.push(chunk);
}
return chunks;
}
/**
* Transcribes a single audio chunk using the Whisper‑large‑v3‑turbo model.
* The function converts the audio chunk to a Base64-encoded string and
* sends it to the model via the AI binding.
*
* @param chunkBuffer - The audio chunk as an ArrayBuffer.
* @param env - The Cloudflare Worker environment, including the AI binding.
* @returns The transcription text from the model.
*/
async function transcribeChunk(
chunkBuffer: ArrayBuffer,
env: Env,
): Promise<string> {
const base64 = Buffer.from(chunkBuffer, "binary").toString("base64");
const res = await env.AI.run("@cf/openai/whisper-large-v3-turbo", {
audio: base64,
// Optional parameters (uncomment and set if needed):
// task: "transcribe", // or "translate"
// language: "en",
// vad_filter: "false",
// initial_prompt: "Provide context if needed.",
// prefix: "Transcription:",
});
return res.text; // Assumes the transcription result includes a "text" property.
}
/**
* The main fetch handler. It extracts the 'url' query parameter, fetches the audio,
* processes it in chunks, and returns the full transcription.
*/
export default {
async fetch(
request: Request,
env: Env,
ctx: ExecutionContext,
): Promise<Response> {
// Extract the audio URL from the query parameters.
const { searchParams } = new URL(request.url);
const audioUrl = searchParams.get("url");
if (!audioUrl) {
return new Response("Missing 'url' query parameter", { status: 400 });
}
// Get the audio chunks.
const audioChunks: ArrayBuffer[] = await getAudioChunks(audioUrl);
let fullTranscript = "";
// Process each chunk and build the full transcript.
for (const chunk of audioChunks) {
try {
const transcript = await transcribeChunk(chunk, env);
fullTranscript += transcript + "\n";
} catch (error) {
fullTranscript += "[Error transcribing chunk]\n";
}
}
return new Response(fullTranscript, {
headers: { "Content-Type": "text/plain" },
});
},
} satisfies ExportedHandler<Env>; 5 triển khai công nhân của bạn 5. Deploy your Worker 5 ។ បញ្ចូលការងាររបស់អ្នក
Phần «Triển khai your Worker» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.
Read the "5. Deploy your Worker" section below — open the official docs link for full screenshots and configuration tabs.
អានផ្នែក «5 ។ បញ្ចូលការងាររបស់អ្នក» ខាងក្រោម — បើកតំណ docs ផ្លូវការសម្រាប់រូបភាព និង tab កំណត់។
- Run the Worker locally:
- Run the Worker locally:
- Run the Worker locally:
npx wrangler dev curl "http://localhost:8787?url=https://raw.githubusercontent.com/your-username/your-repo/main/your-audio-file.mp3" - Deploy the Worker:
- Deploy the Worker:
- Deploy the Worker:
npx wrangler deploy - Test the deployed Worker:
- Test the deployed Worker:
- Test the deployed Worker:
curl "https://<your-worker-subdomain>.workers.dev?url=https://raw.githubusercontent.com/your-username/your-repo/main/your-audio-file.mp3" <your-worker-subdomain>, your-username, your-repo và your-audio-file.mp3 bằng các chi tiết thực tế của bạn.<your-worker-subdomain>, your-username, your-repo, and your-audio-file.mp3 with your actual details.<your-worker-subdomain>, your-username, your-repo និង your-audio-file.mp3 ជាមួយនឹងព័ត៌មានរបស់អ្នកពិតប្រាកដ។This is the transcript of the audio... {"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@id":"/directory/","name":"Directory"}},{"@type":"ListItem","position":2,"item":{"@id":"/workers-ai/","name":"Workers AI"}},{"@type":"ListItem","position":3,"item":{"@id":"/workers-ai/guides/","name":"Guides"}},{"@type":"ListItem","position":4,"item":{"@id":"/workers-ai/guides/tutorials/","name":"Tutorials"}},{"@type":"ListItem","position":5,"item":{"@id":"/workers-ai/guides/tutorials/build-a-workers-ai-whisper-with-chunking/","name":"Whisper-large-v3-turbo with Cloudflare Workers AI"}}]} Xem bản đầy đủ trên developers.cloudflare.com (ảnh, tab cấu hình). View the full guide on developers.cloudflare.com (images, config tabs). មើលមគ្គុទ្ទេសក៍ពេញលើ developers.cloudflare.com (រូបភាព, tab កំណត់)។
Tài liệu gốc ↗ Official docs ↗ ឯកសារផ្លូវការ ↗