Update app.py
Browse files
app.py
CHANGED
@@ -18,43 +18,17 @@ from processDoubles import process_doubles
|
|
18 |
from replaceWords import replace_words
|
19 |
|
20 |
transcriber = pipeline(task="automatic-speech-recognition", model="cdactvm/w2v-bert-2.0-hindi_v1")
|
21 |
-
# processor = AutoProcessor.from_pretrained("cdactvm/w2v-bert-2.0-hindi_v1")
|
22 |
|
23 |
-
# vocab_dict = processor.tokenizer.get_vocab()
|
24 |
|
25 |
-
# sorted_vocab_dict = {k.lower(): v for k, v in sorted(vocab_dict.items(), key=lambda item: item[1])}
|
26 |
-
# decoder = build_ctcdecoder(
|
27 |
-
# labels=list(sorted_vocab_dict.keys()),
|
28 |
-
# kenlm_model_path="lm.binary",
|
29 |
-
# )
|
30 |
-
# processor_with_lm = Wav2Vec2ProcessorWithLM(
|
31 |
-
# feature_extractor=processor.feature_extractor,
|
32 |
-
# tokenizer=processor.tokenizer,
|
33 |
-
# decoder=decoder
|
34 |
-
# )
|
35 |
-
# processor.feature_extractor._processor_class = "Wav2Vec2ProcessorWithLM"
|
36 |
-
|
37 |
-
|
38 |
def transcribe(audio):
|
39 |
# # Process the audio file
|
40 |
transcript = transcriber(audio)
|
41 |
text_value = transcript['text']
|
42 |
-
print(text_value)
|
43 |
processd_doubles=process_doubles(text_value)
|
44 |
-
|
45 |
-
replaced_words = replace_words(converted_to_list)
|
46 |
converted_text=text_to_int(replaced_words)
|
47 |
return converted_text
|
48 |
|
49 |
-
|
50 |
-
# demo = gr.Interface(
|
51 |
-
# transcribe,
|
52 |
-
# gr.Audio(sources="microphone", type="filepath"),
|
53 |
-
# "text",
|
54 |
-
# )
|
55 |
-
|
56 |
-
# demo.launch()
|
57 |
-
|
58 |
demo=gr.Interface(
|
59 |
transcribe,
|
60 |
inputs=[
|
|
|
18 |
from replaceWords import replace_words
|
19 |
|
20 |
transcriber = pipeline(task="automatic-speech-recognition", model="cdactvm/w2v-bert-2.0-hindi_v1")
|
|
|
21 |
|
|
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
def transcribe(audio):
|
24 |
# # Process the audio file
|
25 |
transcript = transcriber(audio)
|
26 |
text_value = transcript['text']
|
|
|
27 |
processd_doubles=process_doubles(text_value)
|
28 |
+
replaced_words = replace_words(processd_doubles)
|
|
|
29 |
converted_text=text_to_int(replaced_words)
|
30 |
return converted_text
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
demo=gr.Interface(
|
33 |
transcribe,
|
34 |
inputs=[
|