Spaces:
Running
Running
p commited on
Commit ·
7b6aa43
1
Parent(s): a82b119
number to word before punct replacement
Browse files42 unmodified lines434445464748495037 unmodified lines888990919293949533 unmodified lines12913013113213313413513636 unmodified lines1731741751761771781791804 unmodified lines18518618718818919019119219319442 unmodified lineswith open("lang_code.json") as f:lang_codes = json.load(f, object_pairs_hook=OrderedDict)lang_codes = {key + " (" + lang_codes[key] + ")": lang_codes[key] for key in lang_codes}# Extract language nameslanguage_names = list(lang_codes.keys())37 unmodified linesprint("Processed text", text)paragraphs = [paragraph for paragraph in text.split("\n") if paragraph.strip()]if lang.lower() == "vie":for paragraph in paragraphs:33 unmodified linesdef combine_wav(source_dir, stamp):# Get a list of all WAV files in the folderwav_files = [file for file in os.listdir(source_dir) if file.endswith(".wav")]# Sort the files alphabetically to ensure the correct order of combinationwav_files.sort()36 unmodified linesprint("New user directory", user_dir)for i, sentence in enumerate(sentences):tts.synthesis(sentence, wav_path=f"{user_dir}/s_{str(i).zfill(10)}.wav")combined_file_path = combine_wav(user_dir, timestamp)return combined_file_path4 unmodified linestitle="Massively Multilingual Speech (MMS) - Text To Speech",description=this_description,inputs=[gr.Textbox(lines=5, placeholder="Enter text to speech",label="Input text"),gr.Dropdown(choices=language_names, label="Select language 1,000+", value="Burmese (mya)"),],outputs="audio",42 unmodified lines4344454647484937 unmodified lines8788899091929333 unmodified lines12712812913013113213336 unmodified lines1701711721731741751764 unmodified lines18118218318418518618718818919019142 unmodified lineswith open("lang_code.json") as f:lang_codes = json.load(f, object_pairs_hook=OrderedDict)lang_codes = {key + " (" + lang_codes[key] + ")": lang_codes[key] for key in lang_codes}# Extract language nameslanguage_names = list(lang_codes.keys())37 unmodified linesprint("Processed text", text)paragraphs = [paragraph for paragraph in text.split("\n") if paragraph.strip()]if lang.lower() == "vie":for paragraph in paragraphs:33 unmodified linesdef combine_wav(source_dir, stamp):# Get a list of all WAV files in the folderwav_files = [file for file in os.listdir(source_dir) if file.endswith(".wav")]# Sort the files alphabetically to ensure the correct order of combinationwav_files.sort()36 unmodified linesprint("New user directory", user_dir)for i, sentence in enumerate(sentences):tts.synthesis(sentence, wav_path=f"{user_dir}/s_{str(i).zfill(10)}.wav")combined_file_path = combine_wav(user_dir, timestamp)return combined_file_path4 unmodified linestitle="Massively Multilingual Speech (MMS) - Text To Speech",description=this_description,inputs=[gr.Textbox(lines=5, placeholder="Enter text to speech", label="Input text"),gr.Dropdown(choices=language_names,label="Select language 1,000+",value="Burmese (mya)",),],outputs="audio",
app.py+8-11