You upload an audio file and get a cached transcription.
This is a microservice approach built on the Cloudflare Stack that shares uploaded audio and cached transcriptions. It uses a WorkerEntryPoint for RPC to connected service bindings.
This service exposes the following methods:
listUploads()
- List available transcribed uploadsget(key)
- Retrieve a specific upload URL and metadatadelete(key)
- Delete an existing transcription
After it is deployed, you can use it in an existing Worker like so:
[[services]]
binding = "UPLOADER"
service = "autotranscriber"
entrypoint = "Uploader"
const uploads = await env.UPLOADER.listUploads();
Transcripts are auto generated by adding to the uploads
bucket created below in the Setup step.
We are going to provision an R2 bucket, a Queue, and a KV Namespace to cache our results from the Whisper model hosted on Workers AI.
# Create a new object storage R2 bucket named "uploads"
npx wrangler r2 bucket create uploads
# This will enable the bucket to serve the file
npx wrangler r2 bucket dev-url enable uploads
# ✨ Public access enabled at 'https://pub-your-url-here.r2.dev'.
Modify your wrangler.json with your bucket id.
NOTE: You can edit your CORS Headers if you want to access this from another application
# Create a new Queue named "uploaded"
npx wrangler queues create uploaded
# Get notified of creations and deletions to "uploads" bucket via the "uploaded" Queue
npx wrangler r2 bucket notification create uploads --event-type object-create --event-type object-delete --queue uploaded
# Create a KV store where you can cache your results
npx wrangler kv namespace create uploaded-metadata
npm run dev
If you want Type completion in your worker:
interface Env {
UPLOADER: Fetcher<import("../autotranscriber/src/").Uploader>;
}
npm run deploy