Spaces:
Runtime error
Runtime error
xJuuzouYTx commited on
Commit ·
6f1ebe2
1
Parent(s): 1b5ebf2
[ADD] elevenlabs tts
Browse filesFiles changed (4)
- app.py+20-12
- requirements.txt+1-1
- tts/constants.py+1-1
- tts/conversion.py+26-7
6 unmodified lines78910111213116 unmodified lines13013113213313413513613713824 unmodified lines16316416516616716816917017117217317417517617717817918018116 unmodified lines1981992002012022032046 unmodified linesimport requestsimport jsonfrom tts.constants import VOICE_METHODS, BARK_VOICES, EDGE_VOICESfrom tts.conversion import tts_inferapi_url = "https://rvc-models-api.onrender.com/uploadfile/"116 unmodified linesdef update_tts_methods_voice(select_value):if select_value == "Edge-tts":return gr.update(choices=EDGE_VOICES)elif select_value == "Bark-tts":return gr.update(choices=BARK_VOICES)with gr.Blocks() as app:gr.HTML("<h1> Simple RVC Inference - by Juuxn 💻 </h1>")24 unmodified lineswith gr.Row():tts_model_url = gr.Textbox(placeholder="https://huggingface.co/AIVER-SE/BillieEilish/resolve/main/BillieEilish.zip", label="Url del modelo RVC", show_label=True)with gr.Column():tts_method = gr.Dropdown(choices=VOICE_METHODS, value="Edge-tts", label="Método TTS:", visible=False)tts_model = gr.Dropdown(choices=EDGE_VOICES, label="Modelo TTS:", visible=True, interactive=True)tts_method.change(fn=update_tts_methods_voice, inputs=[tts_method], outputs=[tts_model])with gr.Row():tts_vc_output1 = gr.Textbox(label="Salida")tts_vc_output2 = gr.Audio(label="Audio de salida")tts_btn = gr.Button(value="Convertir")tts_btn.click(fn=tts_infer, inputs=[tts_text, tts_model_url, tts_method, tts_model], outputs=[tts_vc_output1, tts_vc_output2])with gr.Tab("Recursos"):gr.HTML("<h4>Buscar modelos</h4>")search_name = gr.Textbox(placeholder="Billie Eillish (RVC v2 - 100 epoch)", label="Nombre", show_label=True)# Salida16 unmodified linesbtn_post_model = gr.Button(value="Publicar")btn_post_model.click(fn=post_model, inputs=[post_name, post_model_url, post_version, post_creator], outputs=[post_output])# with gr.Column():# model_voice_path07 = gr.Dropdown(# label=i18n("RVC Model:"),6 unmodified lines78910111213116 unmodified lines13013113213313413513613713813914024 unmodified lines16516616716816917017117217317417517617717817918018118218318418518618718818919016 unmodified lines2072082092102112126 unmodified linesimport requestsimport jsonfrom tts.constants import VOICE_METHODS, BARK_VOICES, EDGE_VOICESfrom tts.conversion import tts_infer, ELEVENLABS_VOICES_RAW, ELEVENLABS_VOICES_NAMESapi_url = "https://rvc-models-api.onrender.com/uploadfile/"116 unmodified linesdef update_tts_methods_voice(select_value):if select_value == "Edge-tts":return gr.update(choices=EDGE_VOICES), gr.Markdown.update(visible=False), gr.Textbox.update(visible=False)elif select_value == "Bark-tts":return gr.update(choices=BARK_VOICES), gr.Markdown.update(visible=False), gr.Textbox.update(visible=False)elif select_value == 'ElevenLabs':return gr.update(choices=ELEVENLABS_VOICES_NAMES), gr.Markdown.update(visible=True), gr.Textbox.update(visible=True)with gr.Blocks() as app:gr.HTML("<h1> Simple RVC Inference - by Juuxn 💻 </h1>")24 unmodified lineswith gr.Row():tts_model_url = gr.Textbox(placeholder="https://huggingface.co/AIVER-SE/BillieEilish/resolve/main/BillieEilish.zip", label="Url del modelo RVC", show_label=True)with gr.Row():tts_method = gr.Dropdown(choices=VOICE_METHODS, value="ElevenLabs", label="Método TTS:", visible=True)tts_model = gr.Dropdown(choices=ELEVENLABS_VOICES_NAMES, label="Modelo TTS:", visible=True, interactive=True)tts_api_key = gr.Textbox(label="ElevenLabs Api key", show_label=True, placeholder="4a4afce72349680c8e8b6fdcfaf2b65a",interactive=True)tts_btn = gr.Button(value="Convertir")with gr.Row():tts_vc_output1 = gr.Textbox(label="Salida")tts_vc_output2 = gr.Audio(label="Audio de salida")tts_btn.click(fn=tts_infer, inputs=[tts_text, tts_model_url, tts_method, tts_model, tts_api_key], outputs=[tts_vc_output1, tts_vc_output2])tts_msg = gr.Markdown("""**Recomiendo que te crees una cuenta de eleven labs y pongas tu clave de api, es gratis y tienes 10k caracteres de limite al mes.** <br/>""", visible=True)tts_method.change(fn=update_tts_methods_voice, inputs=[tts_method], outputs=[tts_model, tts_msg, tts_api_key])with gr.Tab("Modelos"):gr.HTML("<h4>Buscar modelos</h4>")search_name = gr.Textbox(placeholder="Billie Eillish (RVC v2 - 100 epoch)", label="Nombre", show_label=True)# Salida16 unmodified linesbtn_post_model = gr.Button(value="Publicar")btn_post_model.click(fn=post_model, inputs=[post_name, post_model_url, post_version, post_creator], outputs=[post_output])# with gr.Column():# model_voice_path07 = gr.Dropdown(# label=i18n("RVC Model:"),
26 unmodified lines2728293031323326 unmodified linesdecorator==5.1.1discord.py==2.3.2edge-tts==6.1.5elevenlabs==0.2.21entrypoints==0.4exceptiongroup==1.1.3executing==1.2.026 unmodified lines2728293031323326 unmodified linesdecorator==5.1.1discord.py==2.3.2edge-tts==6.1.5elevenlabsentrypoints==0.4exceptiongroup==1.1.3executing==1.2.0
1234VOICE_METHODS = ["Edge-tts", "Bark-tts"]BARK_VOICES = ["v2/en_speaker_0-Male",1234VOICE_METHODS = ["Edge-tts", "ElevenLabs",]BARK_VOICES = ["v2/en_speaker_0-Male",
6 unmodified lines78910111237 unmodified lines5051525354555657585960616263646528 unmodified lines9495969798991006 unmodified linesimport edge_ttsfrom inference import Inferenceimport asyncio#git+https://github.com/suno-ai/bark.git# from transformers import AutoProcessor, BarkModel# import nltk37 unmodified lines# return speech, sampling_ratedef tts_infer(tts_text, model_url, tts_method, tts_model):print("*****************")print(tts_text)print(model_url)if not tts_text:return 'Primero escribe el texto que quieres convertir.', Noneif not tts_model:return 'Selecciona un modelo TTS antes de convertir.', Noneif not model_url:return 'Escribe la url de modelo que quieres usar antes de convertir.', Nonef0_method = "harvest"output_folder = "audios"28 unmodified linestts.save(converted_tts_filename)print("Error: Audio will be replaced.")success = False# elif tts_method == "Bark-tts":# try:# script = tts_text.replace("\n", " ").strip()6 unmodified lines78910111213141516171819202122232437 unmodified lines626364656667686970717228 unmodified lines1011021031041051061071081091101111121131141151161171181196 unmodified linesimport edge_ttsfrom inference import Inferenceimport asynciofrom elevenlabs import voices, generate, saveELEVENLABS_VOICES_RAW = voices()def get_elevenlabs_voice_names():elevenlabs_voice_names = []for voice in ELEVENLABS_VOICES_RAW:elevenlabs_voice_names.append(voice.name)return elevenlabs_voice_namesELEVENLABS_VOICES_NAMES = get_elevenlabs_voice_names()#git+https://github.com/suno-ai/bark.git# from transformers import AutoProcessor, BarkModel# import nltk37 unmodified lines# return speech, sampling_ratedef tts_infer(tts_text, model_url, tts_method, tts_model, tts_api_key):if not tts_text:return 'Primero escribe el texto que quieres convertir.', Noneif not tts_model:return 'Selecciona un modelo TTS antes de convertir.', Nonef0_method = "harvest"output_folder = "audios"28 unmodified linestts.save(converted_tts_filename)print("Error: Audio will be replaced.")success = Falseif tts_method == 'ElevenLabs':audio = generate(text=tts_text,voice=tts_model,model="eleven_multilingual_v2",api_key=tts_api_key)save(audio=audio, filename=converted_tts_filename)success = Trueif not model_url:return 'Pon la url del modelo si quieres aplicarle otro tono.', converted_tts_filename# elif tts_method == "Bark-tts":# try:# script = tts_text.replace("\n", " ").strip()
app.py+20-12
requirements.txt+1-1
tts/constants.py+1-1
tts/conversion.py+26-7