azamat commited on
Commit
7dbebac
·
1 Parent(s): 7a209f6

Added all langs

Browse files
Files changed (1) hide show
  1. app.py +27 -9
app.py CHANGED
@@ -7,6 +7,23 @@ models = [
7
  "https://github.com/AI4Bharat/Indic-TTS/releases/download/v1-checkpoints-release/bn.zip"
8
  ]
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  for model in models:
11
  os.system(f"wget {model}")
12
  os.system(f"unzip {model.split('/')[-1]}")
@@ -23,26 +40,27 @@ for model in models:
23
 
24
 
25
  def convert(text, language, out = "out.wav"):
26
- if language == "Hindi":
27
- m = "hi"
28
- else:
29
- m = "bn"
30
-
31
- os.system(f'python3 -m TTS.bin.synthesize --text "{text}" --model_path {m}/fastpitch/best_model.pth --config_path {m}/fastpitch/config.json --vocoder_path {m}/hifigan/best_model.pth --vocoder_config_path {m}/hifigan/config.json --speaker_idx "male" --out_path {out}')
32
 
33
- return out
34
 
35
  text = gr.Textbox(value = "यह कल का दिन अद्भुत था क्योंकि हम संगीत कार्यक्रम से वापस आ गए हैं।",
36
  placeholder = "Enter a text to synthesize",
37
  label = "Text")
38
 
39
- language = gr.Dropdown(choices = ["Hindi", "Bangla"],
40
  value = "Hindi",
41
  type = "value",
42
  label = "Language")
43
 
44
  inputs = [text, language]
45
- outputs = gr.outputs.Audio(label = "Output Audio", type = 'filepath')
 
 
 
46
 
47
  title = "Indic Languages Speech Synthesis"
48
 
 
7
  "https://github.com/AI4Bharat/Indic-TTS/releases/download/v1-checkpoints-release/bn.zip"
8
  ]
9
 
10
+ languages = {
11
+ "Assamese": "as",
12
+ "Bengali": "bn",
13
+ "Bodo": "brx",
14
+ "Gujarati": "gu",
15
+ "Hindi" : "hi",
16
+ "Kannada": "kn",
17
+ "Manipuri": "mni",
18
+ "Malayalam": "ml",
19
+ "Marathi": "mr",
20
+ "Odia": "or",
21
+ "Punjabi": "pa",
22
+ "Rajasthani": "raj",
23
+ "Tamil": "ta",
24
+ "Telugu": "te"
25
+ }
26
+
27
  for model in models:
28
  os.system(f"wget {model}")
29
  os.system(f"unzip {model.split('/')[-1]}")
 
40
 
41
 
42
  def convert(text, language, out = "out.wav"):
43
+ m = languages[language]
44
+
45
+ os.system(f'python3 -m TTS.bin.synthesize --text "{text}" --model_path {m}/fastpitch/best_model.pth --config_path {m}/fastpitch/config.json --vocoder_path {m}/hifigan/best_model.pth --vocoder_config_path {m}/hifigan/config.json --speaker_idx "male" --out_path male_{out}')
46
+ os.system(f'python3 -m TTS.bin.synthesize --text "{text}" --model_path {m}/fastpitch/best_model.pth --config_path {m}/fastpitch/config.json --vocoder_path {m}/hifigan/best_model.pth --vocoder_config_path {m}/hifigan/config.json --speaker_idx "male" --out_path female_{out}')
 
 
47
 
48
+ return f"male_{out}", f"female_{out}"
49
 
50
  text = gr.Textbox(value = "यह कल का दिन अद्भुत था क्योंकि हम संगीत कार्यक्रम से वापस आ गए हैं।",
51
  placeholder = "Enter a text to synthesize",
52
  label = "Text")
53
 
54
+ language = gr.Dropdown(choices = sorted(languages.keys()),
55
  value = "Hindi",
56
  type = "value",
57
  label = "Language")
58
 
59
  inputs = [text, language]
60
+ outputs = [
61
+ gr.outputs.Audio(label = "Male Speaker", type = 'filepath'),
62
+ gr.outputs.Audio(label = "Female Speaker", type = 'filepath'),
63
+ ]
64
 
65
  title = "Indic Languages Speech Synthesis"
66