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 lines7891010111213116 unmodified lines13013113213313313413513513613713813914024 unmodified lines16516616716616716816917016816917017117217317417517617717817517617918018118218318418518617818718818919016 unmodified lines2072082092012102112126 unmodified linesimport requestsimport jsonfrom tts.constants import VOICE_METHODS, BARK_VOICES, EDGE_VOICESfrom tts.conversion import tts_inferfrom tts.conversion import tts_infer, ELEVENLABS_VOICES_RAW, ELEVENLABS_VOICES_NAMES
api_url = "https://rvc-models-api.onrender.com/uploadfile/"
116 unmodified lines def update_tts_methods_voice(select_value): if select_value == "Edge-tts": return gr.update(choices=EDGE_VOICES) 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) 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 lines with 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_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 = 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]) 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("Recursos"): 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 lines btn_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 lines272829303031323326 unmodified linesdecorator==5.1.1discord.py==2.3.2edge-tts==6.1.5elevenlabs==0.2.21elevenlabsentrypoints==0.4exceptiongroup==1.1.3executing==1.2.011234VOICE_METHODS = ["Edge-tts", "Bark-tts"]VOICE_METHODS = ["Edge-tts", "ElevenLabs",]
BARK_VOICES = [ "v2/en_speaker_0-Male",6 unmodified lines78910111213141516171819202122232437 unmodified lines626364535455566566676869616270717228 unmodified lines101102103104105106107108109110111112971131141151161171181196 unmodified linesimport edge_ttsfrom inference import Inferenceimport asynciofrom elevenlabs import voices, generate, save
ELEVENLABS_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_names
ELEVENLABS_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_rate
def tts_infer(tts_text, model_url, tts_method, tts_model): print("*****************") print(tts_text) print(model_url)def 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.', None if not tts_model: return 'Selecciona un modelo TTS antes de convertir.', None if not model_url: return 'Escribe la url de modelo que quieres usar antes de convertir.', None f0_method = "harvest" output_folder = "audios"28 unmodified lines tts.save(converted_tts_filename) print("Error: Audio will be replaced.") success = False if 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 = True if 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