Files changed (1) hide show
  1. app.py +1 -22
app.py CHANGED
@@ -89,7 +89,7 @@ PREDEFINED_EXAMPLES = {
89
  },
90
  "single-speaker-bgm": {
91
  "system_prompt": DEFAULT_SYSTEM_PROMPT,
92
- "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]",
93
  "description": "Single speaker with BGM using music tag. This is an experimental feature and you may need to try multiple times to get the best result.",
94
  },
95
  }
@@ -184,22 +184,6 @@ def normalize_text(transcript: str):
184
  transcript = transcript.replace(")", " ")
185
  transcript = transcript.replace("°F", " degrees Fahrenheit")
186
  transcript = transcript.replace("°C", " degrees Celsius")
187
-
188
- for tag, replacement in [
189
- ("[laugh]", "<SE>[Laughter]</SE>"),
190
- ("[humming start]", "<SE>[Humming]</SE>"),
191
- ("[humming end]", "<SE_e>[Humming]</SE_e>"),
192
- ("[music start]", "<SE_s>[Music]</SE_s>"),
193
- ("[music end]", "<SE_e>[Music]</SE_e>"),
194
- ("[music]", "<SE>[Music]</SE>"),
195
- ("[sing start]", "<SE_s>[Singing]</SE_s>"),
196
- ("[sing end]", "<SE_e>[Singing]</SE_e>"),
197
- ("[applause]", "<SE>[Applause]</SE>"),
198
- ("[cheering]", "<SE>[Cheering]</SE>"),
199
- ("[cough]", "<SE>[Cough]</SE>"),
200
- ]:
201
- transcript = transcript.replace(tag, replacement)
202
-
203
  lines = transcript.split("\n")
204
  transcript = "\n".join([" ".join(line.split()) for line in lines if line.strip()])
205
  transcript = transcript.strip()
@@ -546,8 +530,6 @@ def create_ui():
546
  # Enable voice preset and custom reference only for voice-clone template
547
  is_voice_clone = template_name == "voice-clone"
548
  voice_preset_value = "belinda" if is_voice_clone else "EMPTY"
549
- # Set ras_win_len to 0 for single-speaker-bgm, 7 for others
550
- ras_win_len_value = 0 if template_name == "single-speaker-bgm" else 7
551
  description_text = f'<p style="font-size: 0.85em; color: var(--body-text-color-subdued); margin: 0; padding: 0;"> {template["description"]}</p>'
552
  return (
553
  template["system_prompt"], # system_prompt
@@ -558,7 +540,6 @@ def create_ui():
558
  ), # voice_preset (value and interactivity)
559
  gr.update(visible=is_voice_clone), # custom reference accordion visibility
560
  gr.update(visible=is_voice_clone), # voice samples section visibility
561
- ras_win_len_value, # ras_win_len
562
  )
563
  else:
564
  return (
@@ -568,7 +549,6 @@ def create_ui():
568
  gr.update(),
569
  gr.update(),
570
  gr.update(),
571
- gr.update(),
572
  ) # No change if template not found
573
 
574
  # Set up event handlers
@@ -584,7 +564,6 @@ def create_ui():
584
  voice_preset,
585
  custom_reference_accordion,
586
  voice_samples_section,
587
- ras_win_len,
588
  ],
589
  )
590
 
 
89
  },
90
  "single-speaker-bgm": {
91
  "system_prompt": DEFAULT_SYSTEM_PROMPT,
92
+ "input_text": "<SE_s>[Music]</SE_s> 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. <SE_e>[Music]</SE_e>",
93
  "description": "Single speaker with BGM using music tag. This is an experimental feature and you may need to try multiple times to get the best result.",
94
  },
95
  }
 
184
  transcript = transcript.replace(")", " ")
185
  transcript = transcript.replace("°F", " degrees Fahrenheit")
186
  transcript = transcript.replace("°C", " degrees Celsius")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  lines = transcript.split("\n")
188
  transcript = "\n".join([" ".join(line.split()) for line in lines if line.strip()])
189
  transcript = transcript.strip()
 
530
  # Enable voice preset and custom reference only for voice-clone template
531
  is_voice_clone = template_name == "voice-clone"
532
  voice_preset_value = "belinda" if is_voice_clone else "EMPTY"
 
 
533
  description_text = f'<p style="font-size: 0.85em; color: var(--body-text-color-subdued); margin: 0; padding: 0;"> {template["description"]}</p>'
534
  return (
535
  template["system_prompt"], # system_prompt
 
540
  ), # voice_preset (value and interactivity)
541
  gr.update(visible=is_voice_clone), # custom reference accordion visibility
542
  gr.update(visible=is_voice_clone), # voice samples section visibility
 
543
  )
544
  else:
545
  return (
 
549
  gr.update(),
550
  gr.update(),
551
  gr.update(),
 
552
  ) # No change if template not found
553
 
554
  # Set up event handlers
 
564
  voice_preset,
565
  custom_reference_accordion,
566
  voice_samples_section,
 
567
  ],
568
  )
569