Spaces:
Runtime error
Runtime error
from fastapi.middleware.cors import CORSMiddleware | |
from app.middlewares.logging import RequestLoggingMiddleware | |
from app.services.speech_analysis import speech_analysis_router | |
from app.utils.constants import API_PREFIX | |
__all__ = ["configure_app"] | |
def configure_app(app): | |
"""Configure and return Fast Application by adding routers and middlewares to the app""" | |
# Configure router | |
app.include_router(speech_analysis_router, prefix=API_PREFIX) | |
# configure middlewares | |
app.add_middleware(RequestLoggingMiddleware) | |
# CORS settings to allow frontend requests | |
app.add_middleware( | |
CORSMiddleware, | |
allow_origins=["*"], | |
allow_credentials=True, | |
allow_methods=["*"], | |
allow_headers=["*"], | |
) | |
return app | |