drewThomasson
commited on
Commit
•
609ffca
1
Parent(s):
9572287
Update app.py
Browse files
app.py
CHANGED
@@ -9,16 +9,18 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
9 |
# Initialize TTS model
|
10 |
tts = TTS(model_name="voice_conversion_models/multilingual/vctk/freevc24", progress_bar=False).to(device)
|
11 |
|
|
|
|
|
|
|
|
|
12 |
def voice_conversion(input_audio, target_voice):
|
13 |
output_path = "output.wav"
|
14 |
# Perform voice conversion
|
|
|
|
|
15 |
tts.voice_conversion_to_file(source_wav=input_audio, target_wav=target_voice, file_path=output_path)
|
16 |
return output_path
|
17 |
|
18 |
-
# Get examples from Examples folder
|
19 |
-
examples_folder = "Examples/"
|
20 |
-
example_files = [f for f in os.listdir(examples_folder) if f.endswith(".wav")]
|
21 |
-
|
22 |
# Define Gradio Interface
|
23 |
with gr.Blocks() as demo:
|
24 |
gr.Markdown("## Voice Conversion using Coqui TTS")
|
|
|
9 |
# Initialize TTS model
|
10 |
tts = TTS(model_name="voice_conversion_models/multilingual/vctk/freevc24", progress_bar=False).to(device)
|
11 |
|
12 |
+
# Get examples from Examples folder
|
13 |
+
examples_folder = "Examples/"
|
14 |
+
example_files = [f for f in os.listdir(examples_folder) if f.endswith(".wav")]
|
15 |
+
|
16 |
def voice_conversion(input_audio, target_voice):
|
17 |
output_path = "output.wav"
|
18 |
# Perform voice conversion
|
19 |
+
target_voice = f"{examples_folder}{target_voice}"
|
20 |
+
print(f"Target voice is: {target_voice}")
|
21 |
tts.voice_conversion_to_file(source_wav=input_audio, target_wav=target_voice, file_path=output_path)
|
22 |
return output_path
|
23 |
|
|
|
|
|
|
|
|
|
24 |
# Define Gradio Interface
|
25 |
with gr.Blocks() as demo:
|
26 |
gr.Markdown("## Voice Conversion using Coqui TTS")
|