Rehman1603 commited on
Commit
64f9a7b
·
verified ·
1 Parent(s): 9f2473b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -5,11 +5,21 @@ device="cuda" if torch.cuda.is_available() else "cpu"
5
 
6
  tts=TTS(model_name="voice_conversion_models/multilingual/vctk/freevc24",progress_bar=False).to(device)
7
  path="output.wav"
8
- def VoiceClone(source_voice,Target_Voice):
9
- return tts.voice_conversion_to_file(source_wav=source_voice, target_wav=Target_Voice, file_path=path)
 
 
 
 
 
 
 
 
 
 
10
 
11
 
12
- interface=gr.Interface(fn=VoiceClone,inputs=[gr.Audio(type="filepath", sources="upload",label='Please upload a source voice'),gr.Audio(type="filepath", sources="upload",label='Please upload Target Voice')],
13
  outputs=[gr.Audio(type="filepath")],
14
  title="Abdul Rehman Voice Cloning and Conversion Tool",
15
  description="Change your voice into Target voice tone")
 
5
 
6
  tts=TTS(model_name="voice_conversion_models/multilingual/vctk/freevc24",progress_bar=False).to(device)
7
  path="output.wav"
8
+ target_voice=""
9
+ source_voice=""
10
+ def VoiceClone(source_Uvoice,source_Mvoice,Target_UVoice,Target_MVoive):
11
+ if source_Uvoice is not None:
12
+ source_voice=source_Uvoice
13
+ elif source_Mvoice is not None:
14
+ source_voice=source_Mvoice
15
+ if Target_UVoice is not None:
16
+ target_voice=Target_UVoice
17
+ elif Target_MVoive is not None:
18
+ target_voice=Target_MVoive
19
+ return tts.voice_conversion_to_file(source_wav=source_voice, target_wav=target_voice, file_path=path)
20
 
21
 
22
+ 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)],
23
  outputs=[gr.Audio(type="filepath")],
24
  title="Abdul Rehman Voice Cloning and Conversion Tool",
25
  description="Change your voice into Target voice tone")