Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ import torchaudio
|
|
7 |
import gradio as gr
|
8 |
import re
|
9 |
|
10 |
-
llasa_model_id = 'OmniAICreator/Galgame-Llasa-1B-
|
11 |
|
12 |
tokenizer = AutoTokenizer.from_pretrained(llasa_model_id)
|
13 |
|
@@ -78,17 +78,12 @@ def normalize(text: str) -> str:
|
|
78 |
text = text.translate(FULLWIDTH_DIGITS_TO_HALFWIDTH)
|
79 |
text = text.translate(HALFWIDTH_KATAKANA_TO_FULLWIDTH)
|
80 |
|
81 |
-
text = re.sub(r"β¦{
|
82 |
-
text = re.sub(r"γΌ{2,}", "γΌ", text)
|
83 |
|
84 |
def replace_special_chars(match):
|
85 |
seq = match.group(0)
|
86 |
return seq[0] if len(set(seq)) == 1 else seq[0] + seq[-1]
|
87 |
|
88 |
-
text = re.sub(r"[!?βͺβ‘]{2,}", replace_special_chars, text)
|
89 |
-
|
90 |
-
repeated = "γγ£γγγγγγγγγ
γγγγ
γγ’γ€γ¦γ¨γͺγ³γ‘γ£γ₯γ§γ©γ£γ₯γ§"
|
91 |
-
text = re.sub(f"([{repeated}])\\1{{2,}}", r"\1\1", text)
|
92 |
return text
|
93 |
|
94 |
def ids_to_speech_tokens(speech_ids):
|
@@ -216,7 +211,7 @@ def infer(sample_audio_path, target_text, temperature, top_p, repetition_penalty
|
|
216 |
return (16000, gen_wav[0, 0, :].cpu().numpy())
|
217 |
|
218 |
with gr.Blocks() as app_tts:
|
219 |
-
gr.Markdown("# Galgame Llasa 1B
|
220 |
ref_audio_input = gr.Audio(label="Reference Audio", type="filepath")
|
221 |
gen_text_input = gr.Textbox(label="Text to Generate", lines=10)
|
222 |
|
|
|
7 |
import gradio as gr
|
8 |
import re
|
9 |
|
10 |
+
llasa_model_id = 'OmniAICreator/Galgame-Llasa-1B-v3'
|
11 |
|
12 |
tokenizer = AutoTokenizer.from_pretrained(llasa_model_id)
|
13 |
|
|
|
78 |
text = text.translate(FULLWIDTH_DIGITS_TO_HALFWIDTH)
|
79 |
text = text.translate(HALFWIDTH_KATAKANA_TO_FULLWIDTH)
|
80 |
|
81 |
+
text = re.sub(r"β¦{3,}", "β¦β¦", text)
|
|
|
82 |
|
83 |
def replace_special_chars(match):
|
84 |
seq = match.group(0)
|
85 |
return seq[0] if len(set(seq)) == 1 else seq[0] + seq[-1]
|
86 |
|
|
|
|
|
|
|
|
|
87 |
return text
|
88 |
|
89 |
def ids_to_speech_tokens(speech_ids):
|
|
|
211 |
return (16000, gen_wav[0, 0, :].cpu().numpy())
|
212 |
|
213 |
with gr.Blocks() as app_tts:
|
214 |
+
gr.Markdown("# Galgame Llasa 1B v3")
|
215 |
ref_audio_input = gr.Audio(label="Reference Audio", type="filepath")
|
216 |
gen_text_input = gr.Textbox(label="Text to Generate", lines=10)
|
217 |
|