OpenCut/apps/transcription
Maze Winther 5b059ce6de feat: auto-captions 2025-08-11 22:24:54 +02:00
..
README.md feat: auto-captions 2025-08-11 22:24:54 +02:00
requirements.txt feat: auto-captions 2025-08-11 22:24:54 +02:00
transcription.py feat: auto-captions 2025-08-11 22:24:54 +02:00

README.md

Before you follow anything in this guide, please make sure you've followed the steps in the README (under "Optional: Auto-captions (Transcription) Setup").

Open your terminal and make sure you're in the apps/transcription directory.

  1. Create virtual environment
python -m venv env
  1. Activate it

Windows:

env\Scripts\activate

macOS/Linux:

source env/bin/activate

Note: if you're using VS Code/Cursor and you're seeing errors with the imports about the modules not being found, You might have to press CTRL + Shift + P -> Python: Select Interpreter -> Enter interpreter path -> Find -> env -> scripts -> python.exe

  1. Install libraries/packages/whatever you wanna call them
pip install -r requirements.txt
  1. Make sure you have a Modal account. If you don't: create one

If you don't know what Modal is: it allows us to process the actual audio and transcribe with Whisper by providing the infra to run Python code with a lot of RAM, generally affordable.

  1. Once you've got a Modal accoumt, run this:
python -m modal setup

It's gonna open a browser so you can authenticate.

  1. Test it if you want to make sure it actually works:
modal run transcription.py
  1. Deploy the function!
modal deploy transcription.py
  1. Set the required secrets in Modal

So the script we just deployed interacts with Cloudflare to do two things:

  • Download the audio (so it can be transcribed with Whisper)
  • Delete the file after processing (privacy)

To do those things, the script needs access to these environment variables:

CLOUDFLARE_ACCOUNT_ID=your-account-id
R2_ACCESS_KEY_ID=your-access-key-id
R2_SECRET_ACCESS_KEY=your-secret-access-key
R2_BUCKET_NAME=opencut-transcription

Remember, we set these earlier in .env.local.

So let's do it:

  • Go to Modal Secrets
  • Click "Custom" and enter "opencut-r2-secrets" for the name.
  • Now you can just click "Import .env" and copy/paste the 4 variables from your .env.local file. Copy and paste these only:
    CLOUDFLARE_ACCOUNT_ID=your-account-id
    R2_ACCESS_KEY_ID=your-access-key-id
    R2_SECRET_ACCESS_KEY=your-secret-access-key
    R2_BUCKET_NAME=opencut-transcription
    
- Click "Done" and you should see some cool particles!