OmniAICreator commited on
Commit
060e6f0
Β·
verified Β·
1 Parent(s): ffb7c5c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
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-v2'
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"…{2,}", "…", text)
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 v2")
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