| | import gradio as gr |
| | from rvc_lib import VoiceConverter |
| | import os |
| |
|
| | |
| | voice_folder = "voices" |
| | voices = {f.split(".")[0]: os.path.join(voice_folder, f) |
| | for f in os.listdir(voice_folder) if f.endswith(".pth")} |
| |
|
| | |
| | def convert_voice(input_audio, selected_voice): |
| | if selected_voice not in voices: |
| | return "Voice model not found!" |
| | vc = VoiceConverter(model_path=voices[selected_voice], voice_name=selected_voice) |
| | return vc.convert(input_audio) |
| |
|
| | |
| | iface = gr.Interface( |
| | fn=convert_voice, |
| | inputs=[ |
| | gr.Audio(source="upload", type="filepath", label="Your Audio"), |
| | gr.Dropdown(list(voices.keys()), label="Select Voice") |
| | ], |
| | outputs=gr.Audio(type="filepath", label="Converted Audio"), |
| | title="RVC Voice Swap", |
| | description="Upload your audio, select a voice, and let AI do the magic!" |
| | ) |
| |
|
| | iface.launch() |