shethjenil commited on
Commit
450eb43
·
verified ·
1 Parent(s): d636ddf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -4
app.py CHANGED
@@ -9,16 +9,29 @@ from indicai_projects.lite_tts import Lite_TTS
9
  from indicai_projects.speech2text_translation import INDIC_SEAMLESS
10
  from indicai_projects.speech2text_all import Indic_STT_ALL
11
  from zipfile import ZipFile
12
-
13
  device = Device("cuda" if cuda_is_available() else "cpu")
14
 
15
  indic_tts_lang = getenv("indic_tts_lang","hi")
16
-
17
  ZipFile(hf_hub_download("shethjenil/CONFORMER_INDIC_STT","conformer_onnx.zip"), 'r').extractall("conformer_onnx")
18
  indic_stt_all_model = Indic_STT_ALL("conformer_onnx",device)
19
  indic_tts = Indic_TTS(indic_tts_lang,device)
20
- sans_tts_model = SansTTS(hf_hub_download("shethjenil/INDIC_TTS","sanskrit_tts_model.pth"),device)
21
  vits_tts = Lite_TTS(device)
22
  indic_seamless_model = INDIC_SEAMLESS(device)
23
 
24
- gr.TabbedInterface([gr.Interface(indic_tts.predict,[gr.Textbox(label="Enter Text"),gr.Dropdown(indic_tts.speakers, label="speaker"),],gr.Audio(type="filepath", label="Speech")),gr.Interface(sans_tts_model.predict,[gr.Textbox(value="उद्यमेन हि सिध्यन्ति कार्याणि न मनोरथैः"),gr.Dropdown(sans_tts_model.speakers,label='Speaker',type='index'),gr.Slider(0.5,2,1,step=0.1,label='Speaking Speed')],gr.Audio(label="Speech")),gr.Interface(vits_tts.predict,[gr.Textbox(),gr.Dropdown(vits_tts.speakers,label='Speaker'),gr.Dropdown(vits_tts.styles,label='Style')],gr.Audio(label="Speech")),gr.Interface(indic_seamless_model.predict,[gr.Audio(type="filepath"),gr.Dropdown(list(indic_seamless_model.lang_conf.keys()), label="Target Language"),],gr.Text(label="Translations"),title="Audio Translation",),gr.Interface(indic_stt_all_model.predict,[gr.Audio(type="filepath"),gr.Dropdown(indic_stt_all_model.supported_langs,label='Language')],[gr.Text(label="CTC"),gr.Text(label="RNNT")]),],[f"{indic_tts.full_name} TTS","Sanskrit TTS","Lite TTS With ","Audio Translation","All Indic Speech To Text",],).launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  from indicai_projects.speech2text_translation import INDIC_SEAMLESS
10
  from indicai_projects.speech2text_all import Indic_STT_ALL
11
  from zipfile import ZipFile
 
12
  device = Device("cuda" if cuda_is_available() else "cpu")
13
 
14
  indic_tts_lang = getenv("indic_tts_lang","hi")
 
15
  ZipFile(hf_hub_download("shethjenil/CONFORMER_INDIC_STT","conformer_onnx.zip"), 'r').extractall("conformer_onnx")
16
  indic_stt_all_model = Indic_STT_ALL("conformer_onnx",device)
17
  indic_tts = Indic_TTS(indic_tts_lang,device)
18
+ sans_tts = SansTTS(device)
19
  vits_tts = Lite_TTS(device)
20
  indic_seamless_model = INDIC_SEAMLESS(device)
21
 
22
+ gr.TabbedInterface(
23
+ [
24
+ gr.Interface(indic_tts.predict,[gr.Textbox(label="Enter Text"),gr.Dropdown(indic_tts.speakers, label="speaker"),],gr.Audio(type="filepath", label="Speech")),
25
+ gr.Interface(sans_tts.predict,[gr.Textbox(value="उद्यमेन हि सिध्यन्ति कार्याणि न मनोरथैः"),gr.Dropdown(sans_tts.speakers,label='Speaker'),gr.Slider(0.5,2,1,step=0.1,label='Speaking Speed')],gr.Audio(label="Speech")),
26
+ gr.Interface(vits_tts.predict,[gr.Textbox(),gr.Dropdown(vits_tts.speakers,label='Speaker'),gr.Dropdown(vits_tts.styles,label='Style')],gr.Audio(label="Speech")),
27
+ gr.Interface(indic_seamless_model.predict,[gr.Audio(type="filepath"),gr.Dropdown(list(indic_seamless_model.lang_conf.keys()), label="Target Language"),],gr.Text(label="Translations"),title="Audio Translation",),
28
+ gr.Interface(indic_stt_all_model.predict,[gr.Audio(type="filepath"),gr.Dropdown(indic_stt_all_model.supported_langs,label='Language')],[gr.Text(label="CTC"),gr.Text(label="RNNT")]),
29
+ ],
30
+ [
31
+ f"{indic_tts.full_name} TTS",
32
+ "Sanskrit TTS",
33
+ "Lite TTS With ",
34
+ "Audio Translation",
35
+ "All Indic Speech To Text",
36
+ ],
37
+ ).launch()