Skip to content

Commit 66de122

Browse files
committed
remove '+'
1 parent fd242ec commit 66de122

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

tts_server.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import uvicorn
22
from fastapi import FastAPI, Request
3+
34
# from fastapi.middleware.cors import CORSMiddleware
4-
from starlette.middleware.cors import CORSMiddleware
5+
from starlette.middleware.cors import CORSMiddleware
56
from pprint import pprint
67
from melo.api import TTS
78
import string
@@ -13,7 +14,7 @@
1314

1415
app = FastAPI()
1516

16-
punc = ''';:@#$%^&*_-~※○●□■△▲◇◆▽▼→←↑↓↔↕↗↘↙↖↙↗↘↖↔↕─│┌┐└┘├┤┬┴┼━┃┏┓┗'''
17+
punc = """;:@#$%^&*-~※○●□■△▲◇◆▽▼→←↑↓↔↕↗↘↙↖↙↗↘↖↔↕─│┌┐└┘├┤┬┴┼━┃┏┓┗+"""
1718

1819
# allowed_origins = [
1920
# "http://localhost.tiangolo.com",
@@ -24,7 +25,7 @@
2425
# "https://localhost:44345",
2526
# ]
2627

27-
allowed_origins=["*"]
28+
allowed_origins = ["*"]
2829

2930
app.add_middleware(
3031
CORSMiddleware,
@@ -52,16 +53,18 @@ async def root():
5253
@app.post("/api/synthesize")
5354
async def apifunction_generate_tts(request: Request):
5455
_json = await request.json()
55-
pprint(_json)
56+
# pprint(_json)
5657
text = _json["text"]
57-
print(text)
58+
# print(text)
5859

5960
for c in text:
6061
if c in punc:
6162
text = text.replace(c, "")
63+
64+
text = text.replace("\n", " ")
6265

63-
text = text.replace('\n', ' ')
64-
66+
# print(text)
67+
6568
response_data = model.tts_to_base64(text, speaker_ids["KR"], speed=speed)
6669
return response_data
6770

0 commit comments

Comments
 (0)