The whisper ASR server does not allow CORS, which has caused issues with testing. We were able to hack it using the following code:
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
app = FastAPI()
allowed_origins = [
"http://localhost:5173", # Make sure this matches the port your frontend is running on
"https://yourfrontenddomain.com", # Replace this with your actual frontend domain
]
app.add_middleware(
CORSMiddleware,
allow_origins=allowed_origins, # List of allowed origins
allow_credentials=True,
allow_methods=["*"], # Allows all methods
allow_headers=["*"], # Allows all headers
)
This code was edited directly in the docker and needs to be preserved this in source or CI.
Ideally, we'll fork the asr-whisperX repo and implement our build pipeline there. We should add an env var to specify the allowed origins at runtime and submit a PR back to the upstream.
It might also be worth looking at running whisper x directly .
The whisper ASR server does not allow CORS, which has caused issues with testing. We were able to hack it using the following code:
This code was edited directly in the docker and needs to be preserved this in source or CI.
Ideally, we'll fork the asr-whisperX repo and implement our build pipeline there. We should add an env var to specify the allowed origins at runtime and submit a PR back to the upstream.
It might also be worth looking at running whisper x directly .