RVX / app.py
Ai128474's picture
Update app.py
982b0a3 verified
raw
history blame contribute delete
916 Bytes
import gradio as gr
from rvc_lib import VoiceConverter
import os
# Load voices folder
voice_folder = "voices"
voices = {f.split(".")[0]: os.path.join(voice_folder, f)
for f in os.listdir(voice_folder) if f.endswith(".pth")}
# Function to convert voice
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)
# Gradio interface
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()