shethjenil commited on
Commit
d636ddf
·
verified ·
1 Parent(s): 2ce4741

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -24
app.py CHANGED
@@ -1,24 +1,24 @@
1
- import gradio as gr
2
- from os import getenv
3
- from huggingface_hub import hf_hub_download
4
- from torch import device as Device
5
- from torch.cuda import is_available as cuda_is_available
6
- from indicai_projects.indic_tts import Indic_TTS
7
- from indicai_projects.sanskrit_tts import SansTTS
8
- 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.List(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()
 
1
+ import gradio as gr
2
+ from os import getenv
3
+ from huggingface_hub import hf_hub_download
4
+ from torch import device as Device
5
+ from torch.cuda import is_available as cuda_is_available
6
+ from indicai_projects.indic_tts import Indic_TTS
7
+ from indicai_projects.sanskrit_tts import SansTTS
8
+ 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()