Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,22 +32,7 @@ from scipy.signal import butter, lfilter, wiener
|
|
| 32 |
|
| 33 |
asr_model = pipeline("automatic-speech-recognition", model="cdactvm/w2v-bert-tamil_new")
|
| 34 |
|
| 35 |
-
def createlex(filename):
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
# Initialize an empty dictionary
|
| 39 |
-
data_dict = {}
|
| 40 |
|
| 41 |
-
# Open the file and read it line by line
|
| 42 |
-
with open(filename, "r", encoding="utf-8") as f:
|
| 43 |
-
for line in f:
|
| 44 |
-
# Strip newline characters and split by tab
|
| 45 |
-
key, value = line.strip().split("\t")
|
| 46 |
-
# Add to dictionary
|
| 47 |
-
data_dict[key] = value
|
| 48 |
-
return data_dict
|
| 49 |
-
|
| 50 |
-
lex=createlex("num_words_ta.txt")
|
| 51 |
# Function to apply a high-pass filter
|
| 52 |
def high_pass_filter(audio, sr, cutoff=300):
|
| 53 |
nyquist = 0.5 * sr
|
|
@@ -70,12 +55,28 @@ def apply_wiener_filter(audio):
|
|
| 70 |
|
| 71 |
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
def addnum(inlist):
|
| 74 |
sum=0
|
| 75 |
for num in inlist:
|
| 76 |
sum+=int(num)
|
| 77 |
|
| 78 |
return sum
|
|
|
|
| 79 |
from rapidfuzz import process
|
| 80 |
def get_val(word, lexicon):
|
| 81 |
threshold = 80 # Minimum similarity score
|
|
|
|
| 32 |
|
| 33 |
asr_model = pipeline("automatic-speech-recognition", model="cdactvm/w2v-bert-tamil_new")
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
# Function to apply a high-pass filter
|
| 37 |
def high_pass_filter(audio, sr, cutoff=300):
|
| 38 |
nyquist = 0.5 * sr
|
|
|
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
+
def createlex(filename):
|
| 59 |
+
# Initialize an empty dictionary
|
| 60 |
+
data_dict = {}
|
| 61 |
+
|
| 62 |
+
# Open the file and read it line by line
|
| 63 |
+
with open(filename, "r", encoding="utf-8") as f:
|
| 64 |
+
for line in f:
|
| 65 |
+
# Strip newline characters and split by tab
|
| 66 |
+
key, value = line.strip().split("\t")
|
| 67 |
+
# Add to dictionary
|
| 68 |
+
data_dict[key] = value
|
| 69 |
+
return data_dict
|
| 70 |
+
|
| 71 |
+
lex=createlex("num_words_ta.txt")
|
| 72 |
+
|
| 73 |
def addnum(inlist):
|
| 74 |
sum=0
|
| 75 |
for num in inlist:
|
| 76 |
sum+=int(num)
|
| 77 |
|
| 78 |
return sum
|
| 79 |
+
|
| 80 |
from rapidfuzz import process
|
| 81 |
def get_val(word, lexicon):
|
| 82 |
threshold = 80 # Minimum similarity score
|