Spaces:
Sleeping
Sleeping
Update app.py
Browse files1234549 unmodified lines555657585960126 unmodified lines18718818919019119219322 unmodified lines216217218219220221222import gradio as grimport torchimport numpy as npimport reimport soundfile as sf49 unmodified linestext = re.sub(r'\b(\d{1,4})\b', lambda m: self.number_to_words(int(m.group())), text)text = re.sub(r'\b(1[0-9]{3}|20[0-9]{2}|2100)\b', lambda m: m.group(), text)text = re.sub(r'[^\w\s\.,!?;:\-\(\)\'"]', ' ', text)return text.strip()def number_to_words(self, num):126 unmodified linesgr.HTML("""<div class="main-header"><h1>π€ Long-Form Text-to-Speech Generator</h1><p style="color: #666; font-size: 1.1em;">Choose a voice and transform any text into expressive human-like speech</p></div>""")if tts_system:22 unmodified lineschar_count = gr.HTML("<span style='color: #666;'>Character count: 0 / 50,000</span>")speaker_dropdown = gr.Dropdown(choices=tts_system.speakers if tts_system else [],value="p225" if tts_system else None,label="π£οΈ Choose Voice")generate_btn = gr.Button("π― Generate Speech", variant="primary", size="lg", scale=1)123449 unmodified lines54555657585960126 unmodified lines18718818919019119219322 unmodified lines216217218219220221222import gradio as grimport numpy as npimport reimport soundfile as sf49 unmodified linestext = re.sub(r'\b(\d{1,4})\b', lambda m: self.number_to_words(int(m.group())), text)text = re.sub(r'\b(1[0-9]{3}|20[0-9]{2}|2100)\b', lambda m: m.group(), text)text = re.sub(r'[^\w\s\.,!?;:\-\(\)\'"]', ' ', text)text = re.sub(r'\s+', ' ', text)return text.strip()def number_to_words(self, num):126 unmodified linesgr.HTML("""<div class="main-header"><h1>π€ Long-Form Text-to-Speech Generator</h1><p style="color: #666; font-size: 1.1em;">Choose a voice and transform any written text into expressive human-like speech</p></div>""")if tts_system:22 unmodified lineschar_count = gr.HTML("<span style='color: #666;'>Character count: 0 / 50,000</span>")speaker_dropdown = gr.Dropdown(choices=tts_system.speakers if tts_system else [],value=tts_system.speakers[0] if tts_system else None,label="π£οΈ Choose Voice")generate_btn = gr.Button("π― Generate Speech", variant="primary", size="lg", scale=1)
app.py+3-3