normalin commited on
Commit
bfc29c2
·
verified ·
1 Parent(s): 35e81b5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -10
app.py CHANGED
@@ -1,3 +1,5 @@
 
 
1
  import gradio as gr
2
  from TTS.api import TTS
3
 
@@ -5,17 +7,39 @@ from TTS.api import TTS
5
  # voice_conversion_models/multilingual/multi-dataset/openvoice_v1
6
  # voice_conversion_models/multilingual/multi-dataset/openvoice_v2
7
  tts = TTS(model_name="voice_conversion_models/multilingual/vctk/freevc24", gpu=False)
 
 
 
8
 
9
-
10
- def greet(source, target):
11
- tts.voice_conversion_to_file(
12
- source_wav=source,
13
- target_wav=target,
14
- file_path="output.wav"
15
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  return "output.wav"
17
 
18
- demo = gr.Interface(fn=greet, inputs=[gr.Audio(value="kratos.wav", type="filepath"),
19
- gr.Audio(value="nikole_kidman.wav", type="filepath")],
 
20
  outputs=gr.Audio(type="filepath"))
21
- demo.launch()
 
1
+ from random import choices
2
+
3
  import gradio as gr
4
  from TTS.api import TTS
5
 
 
7
  # voice_conversion_models/multilingual/multi-dataset/openvoice_v1
8
  # voice_conversion_models/multilingual/multi-dataset/openvoice_v2
9
  tts = TTS(model_name="voice_conversion_models/multilingual/vctk/freevc24", gpu=False)
10
+ tts2 = TTS(model_name="voice_conversion_models/multilingual/multi-dataset/knnvc", gpu=False)
11
+ tts3 = TTS(model_name="voice_conversion_models/multilingual/multi-dataset/openvoice_v1", gpu=False)
12
+ tts4 = TTS(model_name="voice_conversion_models/multilingual/multi-dataset/openvoice_v2", gpu=False)
13
 
14
+ def greet(source, target, choices_s):
15
+ if choices_s == "freevc24":
16
+ tts.voice_conversion_to_file(
17
+ source_wav=source,
18
+ target_wav=target,
19
+ file_path="output.wav"
20
+ )
21
+ elif choices_s == "knnvc":
22
+ tts2.voice_conversion_to_file(
23
+ source_wav=source,
24
+ target_wav=target,
25
+ file_path="output.wav"
26
+ )
27
+ elif choices_s == "openvoice_v1":
28
+ tts3.voice_conversion_to_file(
29
+ source_wav=source,
30
+ target_wav=target,
31
+ file_path="output.wav"
32
+ )
33
+ elif choices_s == "openvoice_v2":
34
+ tts4.voice_conversion_to_file(
35
+ source_wav=source,
36
+ target_wav=target,
37
+ file_path="output.wav"
38
+ )
39
  return "output.wav"
40
 
41
+ demo = gr.Interface(fn=greet, inputs=[gr.Audio(value="kratos.wav", type="filepath"),
42
+ gr.Audio(value="nikole_kidman.wav", type="filepath"),
43
+ gr.Dropdown(choices=["freevc24", "knnvc", "openvoice_v1", "openvoice_v2"])],
44
  outputs=gr.Audio(type="filepath"))
45
+ demo.launch()