Update app.py
Browse files
app.py
CHANGED
@@ -67,6 +67,27 @@
|
|
67 |
# description = "Demo for Automatic Speech Recognition. Use microphone to record speech. Please press Record button. Initially it will take some time to load the model. The recognized text will appear in the output textbox",
|
68 |
# ).launch()
|
69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
import warnings
|
71 |
import gradio as gr
|
72 |
from transformers import pipeline
|
@@ -449,7 +470,7 @@ def cleanhtml(raw_html):
|
|
449 |
# return text
|
450 |
|
451 |
def transcribe_hindi(speech):
|
452 |
-
text =
|
453 |
if text is None:
|
454 |
return "Error: ASR returned None"
|
455 |
|
|
|
67 |
# description = "Demo for Automatic Speech Recognition. Use microphone to record speech. Please press Record button. Initially it will take some time to load the model. The recognized text will appear in the output textbox",
|
68 |
# ).launch()
|
69 |
|
70 |
+
###############################################################
|
71 |
+
import warnings
|
72 |
+
warnings.filterwarnings("ignore")
|
73 |
+
import os
|
74 |
+
import re
|
75 |
+
import gradio as gr
|
76 |
+
import numpy as np
|
77 |
+
import torchaudio
|
78 |
+
import nbimporter
|
79 |
+
from transformers import pipeline
|
80 |
+
from transformers import AutoProcessor
|
81 |
+
from pyctcdecode import build_ctcdecoder
|
82 |
+
from transformers import Wav2Vec2ProcessorWithLM
|
83 |
+
from text2int import text_to_int
|
84 |
+
from isNumber import is_number
|
85 |
+
from Text2List import text_to_list
|
86 |
+
from convert2list import convert_to_list
|
87 |
+
from processDoubles import process_doubles
|
88 |
+
from replaceWords import replace_words
|
89 |
+
|
90 |
+
hindi_model = pipeline(task="automatic-speech-recognition", model="cdactvm/w2v-bert-2.0-hindi_v1")
|
91 |
import warnings
|
92 |
import gradio as gr
|
93 |
from transformers import pipeline
|
|
|
470 |
# return text
|
471 |
|
472 |
def transcribe_hindi(speech):
|
473 |
+
text = hindi_model(speech)["text"]
|
474 |
if text is None:
|
475 |
return "Error: ASR returned None"
|
476 |
|