[O] Allow CORS
This commit is contained in:
@@ -11,6 +11,7 @@ import uvicorn
|
|||||||
from fastapi import FastAPI, HTTPException, Request
|
from fastapi import FastAPI, HTTPException, Request
|
||||||
from fastapi.responses import StreamingResponse
|
from fastapi.responses import StreamingResponse
|
||||||
from hypy_utils.logging_utils import setup_logger
|
from hypy_utils.logging_utils import setup_logger
|
||||||
|
from starlette.middleware.cors import CORSMiddleware
|
||||||
from torch import no_grad, LongTensor
|
from torch import no_grad, LongTensor
|
||||||
|
|
||||||
import commons
|
import commons
|
||||||
@@ -31,6 +32,15 @@ language_marks = {
|
|||||||
"Mix": "",
|
"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):
|
def get_text(text: str, is_symbol: bool):
|
||||||
text_norm = text_to_sequence(text, hps.symbols, [] if is_symbol else hps.data.text_cleaners)
|
text_norm = text_to_sequence(text, hps.symbols, [] if is_symbol else hps.data.text_cleaners)
|
||||||
|
|||||||
Reference in New Issue
Block a user