[O] Allow CORS

This commit is contained in:
2024-07-13 04:23:20 +08:00
parent 61f86358ac
commit 58e2cf78e6
+10
View File
@@ -11,6 +11,7 @@ import uvicorn
from fastapi import FastAPI, HTTPException, Request
from fastapi.responses import StreamingResponse
from hypy_utils.logging_utils import setup_logger
from starlette.middleware.cors import CORSMiddleware
from torch import no_grad, LongTensor
import commons
@@ -31,6 +32,15 @@ language_marks = {
"Mix": "",
}
# Allow all CORS
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
def get_text(text: str, is_symbol: bool):
text_norm = text_to_sequence(text, hps.symbols, [] if is_symbol else hps.data.text_cleaners)