File size: 1,288 Bytes
bfde6e2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
#!/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[ ]:
|