Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,6 +35,7 @@ DEFAULT_SYSTEM_PROMPT = (
|
|
| 35 |
"Generate audio following instruction.\n\n"
|
| 36 |
"<|scene_desc_start|>\n"
|
| 37 |
"Audio is recorded from a quiet room.\n"
|
|
|
|
| 38 |
"<|scene_desc_end|>"
|
| 39 |
)
|
| 40 |
|
|
@@ -99,6 +100,19 @@ PREDEFINED_EXAMPLES = {
|
|
| 99 |
"icon": "๐จ๐ณ",
|
| 100 |
"color": "#AA96DA"
|
| 101 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
"single-speaker-bgm": {
|
| 103 |
"system_prompt": DEFAULT_SYSTEM_PROMPT,
|
| 104 |
"input_text": "[music start] I will remember this, thought Ender, when I am defeated. To keep dignity, and give honor where it's due, so that defeat is not disgrace. And I hope I don't have to do it often. [music end]",
|
|
@@ -196,8 +210,18 @@ def normalize_chinese_punctuation(text):
|
|
| 196 |
|
| 197 |
|
| 198 |
def normalize_text(transcript: str):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
transcript = normalize_chinese_punctuation(transcript)
|
| 200 |
-
|
|
|
|
| 201 |
transcript = transcript.replace("(", " ")
|
| 202 |
transcript = transcript.replace(")", " ")
|
| 203 |
transcript = transcript.replace("ยฐF", " degrees Fahrenheit")
|
|
|
|
| 35 |
"Generate audio following instruction.\n\n"
|
| 36 |
"<|scene_desc_start|>\n"
|
| 37 |
"Audio is recorded from a quiet room.\n"
|
| 38 |
+
"Support for multiple languages including English, Chinese, Korean, Japanese, and more.\n"
|
| 39 |
"<|scene_desc_end|>"
|
| 40 |
)
|
| 41 |
|
|
|
|
| 100 |
"icon": "๐จ๐ณ",
|
| 101 |
"color": "#AA96DA"
|
| 102 |
},
|
| 103 |
+
"single-speaker-kr": {
|
| 104 |
+
"system_prompt": "Generate audio following instruction.\n\n"
|
| 105 |
+
"<|scene_desc_start|>\n"
|
| 106 |
+
"Audio is recorded from a quiet room.\n"
|
| 107 |
+
"<|scene_desc_end|>",
|
| 108 |
+
"input_text": "์๋
ํ์ธ์, ์ค๋์ ์ธ๊ณต์ง๋ฅ์ ๋ฏธ๋์ ๋ํด ์ด์ผ๊ธฐํด๋ณด๊ฒ ์ต๋๋ค.\n"
|
| 109 |
+
"์ต๊ทผ AI ๊ธฐ์ ์ ๋ฐ์ ์ด ์ ๋ง ๋๋ผ์ด๋ฐ์,\n"
|
| 110 |
+
"ํนํ ์์ฑ ํฉ์ฑ ๊ธฐ์ ์ ์ด์ ์ฌ๋๊ณผ ๊ตฌ๋ณํ๊ธฐ ์ด๋ ค์ธ ์ ๋๋ก ์์ฐ์ค๋ฌ์์ก์ต๋๋ค.\n"
|
| 111 |
+
"์ฌ๋ฌ๋ถ์ ์ ๊ฐ ์ค์ ์ฌ๋์ธ์ง AI์ธ์ง ๊ตฌ๋ณํ ์ ์์ผ์ ๊ฐ์?",
|
| 112 |
+
"description": "๐ฐ๐ท <b>Korean Speech</b> - Generate natural Korean speech",
|
| 113 |
+
"icon": "๐ฐ๐ท",
|
| 114 |
+
"color": "#FFB6C1"
|
| 115 |
+
},
|
| 116 |
"single-speaker-bgm": {
|
| 117 |
"system_prompt": DEFAULT_SYSTEM_PROMPT,
|
| 118 |
"input_text": "[music start] I will remember this, thought Ender, when I am defeated. To keep dignity, and give honor where it's due, so that defeat is not disgrace. And I hope I don't have to do it often. [music end]",
|
|
|
|
| 210 |
|
| 211 |
|
| 212 |
def normalize_text(transcript: str):
|
| 213 |
+
# Skip normalization for Korean text to preserve it properly
|
| 214 |
+
if any('\u3131' <= char <= '\u3163' or '\uac00' <= char <= '\ud7a3' for char in transcript):
|
| 215 |
+
# Korean text detected - minimal normalization
|
| 216 |
+
transcript = transcript.strip()
|
| 217 |
+
if transcript and not any([transcript.endswith(c) for c in [".", "!", "?", "ใ", "๏ผ", "๏ผ"]]):
|
| 218 |
+
transcript += "."
|
| 219 |
+
return transcript
|
| 220 |
+
|
| 221 |
+
# Chinese punctuation normalization
|
| 222 |
transcript = normalize_chinese_punctuation(transcript)
|
| 223 |
+
|
| 224 |
+
# Other normalizations (e.g., parentheses and other symbols)
|
| 225 |
transcript = transcript.replace("(", " ")
|
| 226 |
transcript = transcript.replace(")", " ")
|
| 227 |
transcript = transcript.replace("ยฐF", " degrees Fahrenheit")
|