File size: 1,321 Bytes
b723e22
 
 
44fad27
b723e22
44fad27
b723e22
64f9a7b
 
 
 
 
 
 
 
 
 
 
 
b723e22
 
64f9a7b
350bde7
 
cdefc20
b723e22
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import torch
from TTS.api import TTS
import gradio as gr
device="cuda" if torch.cuda.is_available() else "cpu"

tts=TTS(model_name="voice_conversion_models/multilingual/vctk/freevc24",progress_bar=False).to(device)
path="output.wav"
target_voice=""
source_voice=""
def VoiceClone(source_Uvoice,source_Mvoice,Target_UVoice,Target_MVoive):
    if source_Uvoice is not None:
        source_voice=source_Uvoice
    elif source_Mvoice is not None:
        source_voice=source_Mvoice
    if Target_UVoice is not None:
        target_voice=Target_UVoice
    elif Target_MVoive is not None:
        target_voice=Target_MVoive
    return tts.voice_conversion_to_file(source_wav=source_voice, target_wav=target_voice, file_path=path)


interface=gr.Interface(fn=VoiceClone,inputs=[gr.Audio(type="filepath",         sources="upload",label='Please upload a source voice'),gr.Audio(sources="microphone", type="filepath", streaming=True),gr.Audio(type="filepath",         sources="upload",label='Please upload Target Voice'),gr.Audio(sources="microphone", type="filepath", streaming=True)],
                       outputs=[gr.Audio(type="filepath")],
                      title="Abdul Rehman Voice Cloning and Conversion Tool",
                      description="Change your voice into Target voice tone")
interface.launch(debug=True)