Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,7 @@ count = 0
|
|
9 |
For Fairseq models, use the following name format: tts_models/<lang-iso_code>/fairseq/vits. You can find the language ISO codes here and learn about the Fairseq models here.
|
10 |
https://dl.fbaipublicfiles.com/mms/tts/all-tts-languages.html
|
11 |
"""
|
|
|
12 |
api_rus = TTS(f"tts_models/rus/fairseq/vits", gpu=False)
|
13 |
api_eng = TTS(f"tts_models/eng/fairseq/vits", gpu=False)
|
14 |
api_spa = TTS(f"tts_models/spa/fairseq/vits", gpu=False)
|
@@ -16,6 +17,8 @@ api_fas = TTS(f"tts_models/fas/fairseq/vits", gpu=False) # Persian
|
|
16 |
api_tur = TTS(f"tts_models/tur/fairseq/vits", gpu=False) # Turkish
|
17 |
api_deu = TTS(f"tts_models/deu/fairseq/vits", gpu=False) # German, Standard
|
18 |
api_ara = TTS(f"tts_models/ara/fairseq/vits", gpu=False) # Arabic
|
|
|
|
|
19 |
|
20 |
def audio_tts(txt, language, audio_file):
|
21 |
global count
|
@@ -44,11 +47,13 @@ def audio_tts(txt, language, audio_file):
|
|
44 |
api_deu.tts_with_vc_to_file(txt, speaker_wav=audio_file, file_path="ouptut.wav")
|
45 |
elif language == "ara":
|
46 |
api_ara.tts_with_vc_to_file(txt, speaker_wav=audio_file, file_path="ouptut.wav")
|
|
|
|
|
47 |
return "ouptut.wav"
|
48 |
|
49 |
|
50 |
demo = gr.Interface(fn=audio_tts, inputs=[gr.Textbox(label="Input text TTS", value="Привет! Я Макс."),
|
51 |
-
gr.Dropdown(choices=["rus", "eng", "spa", "fas", "tur", "deu", "ara"],label="Language", value="rus"),
|
52 |
gr.Audio(source="upload", type="filepath", label="Input audio")],
|
53 |
outputs=gr.Audio(source="upload", type="filepath", label="Output audio"))
|
54 |
|
|
|
9 |
For Fairseq models, use the following name format: tts_models/<lang-iso_code>/fairseq/vits. You can find the language ISO codes here and learn about the Fairseq models here.
|
10 |
https://dl.fbaipublicfiles.com/mms/tts/all-tts-languages.html
|
11 |
"""
|
12 |
+
|
13 |
api_rus = TTS(f"tts_models/rus/fairseq/vits", gpu=False)
|
14 |
api_eng = TTS(f"tts_models/eng/fairseq/vits", gpu=False)
|
15 |
api_spa = TTS(f"tts_models/spa/fairseq/vits", gpu=False)
|
|
|
17 |
api_tur = TTS(f"tts_models/tur/fairseq/vits", gpu=False) # Turkish
|
18 |
api_deu = TTS(f"tts_models/deu/fairseq/vits", gpu=False) # German, Standard
|
19 |
api_ara = TTS(f"tts_models/ara/fairseq/vits", gpu=False) # Arabic
|
20 |
+
api_por = TTS(f"tts_models/por/fairseq/vits", gpu=False) # Portuguese
|
21 |
+
|
22 |
|
23 |
def audio_tts(txt, language, audio_file):
|
24 |
global count
|
|
|
47 |
api_deu.tts_with_vc_to_file(txt, speaker_wav=audio_file, file_path="ouptut.wav")
|
48 |
elif language == "ara":
|
49 |
api_ara.tts_with_vc_to_file(txt, speaker_wav=audio_file, file_path="ouptut.wav")
|
50 |
+
elif language == "por":
|
51 |
+
api_por.tts_with_vc_to_file(txt, speaker_wav=audio_file, file_path="ouptut.wav")
|
52 |
return "ouptut.wav"
|
53 |
|
54 |
|
55 |
demo = gr.Interface(fn=audio_tts, inputs=[gr.Textbox(label="Input text TTS", value="Привет! Я Макс."),
|
56 |
+
gr.Dropdown(choices=["rus", "eng", "spa", "fas", "tur", "deu", "ara", "por"],label="Language", value="rus"),
|
57 |
gr.Audio(source="upload", type="filepath", label="Input audio")],
|
58 |
outputs=gr.Audio(source="upload", type="filepath", label="Output audio"))
|
59 |
|