Hindi_ASR / main.py
cdactvm's picture
Upload 12 files
bfde6e2 verified
raw
history blame
1.29 kB
#!/usr/bin/env python
# coding: utf-8
# In[1]:
get_ipython().system('pip install nbimporter')
# In[2]:
# Import necessary libraries and filter warnings
import warnings
warnings.filterwarnings("ignore")
import nbimporter
import os
import re
import torchaudio
from transformers import pipeline
from text2int import text_to_int
from isNumber import is_number
from Text2List import text_to_list
from convert2list import convert_to_list
from processDoubles import process_doubles
from replaceWords import replace_words
pipe = pipeline(task="automatic-speech-recognition", model="cdactvm/w2v-bert-2.0-hindi_v1")
# In[4]:
# # Process the audio file
transcript = pipe("C:/Users/WCHL/Desktop/hindi_dataset/train/hindi_numbers_test/hindi7.mp3")
text_value = transcript['text']
processd_doubles=process_doubles(text_value)
# converted_to_list=convert_to_list(processd_doubles,text_to_list())
replaced_words = replace_words(processd_doubles)
converted_text=text_to_int(replaced_words)
print(f"generated text : {text_value}")
print(f"processed doubles : {processd_doubles}")
# print(f"converted to list : {converted_to_list}")
print(f"replaced words : {replaced_words}")
print(f"final text : {converted_text}")
# In[ ]: