Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASR CORS settings #13

Open
dahifi opened this issue Feb 2, 2024 · 0 comments
Open

ASR CORS settings #13

dahifi opened this issue Feb 2, 2024 · 0 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@dahifi
Copy link
Contributor

dahifi commented Feb 2, 2024

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 .

@dahifi dahifi added bug Something isn't working enhancement New feature or request labels Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant