vc-444444 / app.py
Huggedface28481's picture
Update app.py
2a349c8 verified
Raw
History Blame Contribute Delete
1.11 kB
import gradio as gr
from TTS.api import TTS
def greet(source, target, choices_s):
if choices_s == "freevc24":
tts = TTS(model_name="voice_conversion_models/multilingual/vctk/freevc24", gpu=False)
elif choices_s == "knnvc":
tts = TTS(model_name="voice_conversion_models/multilingual/multi-dataset/knnvc", gpu=False)
elif choices_s == "openvoice_v1":
tts = TTS(model_name="voice_conversion_models/multilingual/multi-dataset/openvoice_v1", gpu=False)
elif choices_s == "openvoice_v2":
tts = TTS(model_name="voice_conversion_models/multilingual/multi-dataset/openvoice_v2", gpu=False)
tts.voice_conversion_to_file(
source_wav=source,
target_wav=target,
file_path="output.wav"
)
return "output.wav"
demo = gr.Interface(fn=greet,
inputs=[
gr.Audio(label="Source audio", type="filepath"),
gr.Audio(label="Target audio", type="filepath"),
gr.Dropdown(label="Model name", choices=["freevc24", "knnvc", "openvoice_v1", "openvoice_v2"])
],
outputs=gr.Audio(type="filepath"))
demo.launch()