Harveenchadha
commited on
Commit
•
0de7587
1
Parent(s):
2984fe4
Update app.py
Browse files
app.py
CHANGED
@@ -22,13 +22,12 @@ def read_file(wav):
|
|
22 |
|
23 |
|
24 |
def parse_transcription(wav_file):
|
25 |
-
'''
|
26 |
filename = wav_file.name.split('.')[0]
|
27 |
convert(wav_file.name, filename + "16k.wav")
|
28 |
speech, _ = sf.read(filename + "16k.wav")
|
29 |
|
30 |
-
|
31 |
-
speech = read_file(wav_file)
|
32 |
input_values = processor(speech, sampling_rate=16_000, return_tensors="pt").input_values
|
33 |
|
34 |
logits = model(input_values).logits
|
@@ -43,8 +42,8 @@ model = Wav2Vec2ForCTC.from_pretrained("Harveenchadha/vakyansh-wav2vec2-hindi-hi
|
|
43 |
|
44 |
|
45 |
|
46 |
-
|
47 |
-
input_ = gr.inputs.Audio(source="microphone", type="numpy")
|
48 |
|
49 |
gr.Interface(parse_transcription, inputs = input_, outputs="text",
|
50 |
analytics_enabled=False, show_tips=False, enable_queue=True).launch(inline=False);
|
|
|
22 |
|
23 |
|
24 |
def parse_transcription(wav_file):
|
|
|
25 |
filename = wav_file.name.split('.')[0]
|
26 |
convert(wav_file.name, filename + "16k.wav")
|
27 |
speech, _ = sf.read(filename + "16k.wav")
|
28 |
|
29 |
+
|
30 |
+
#speech = read_file(wav_file)
|
31 |
input_values = processor(speech, sampling_rate=16_000, return_tensors="pt").input_values
|
32 |
|
33 |
logits = model(input_values).logits
|
|
|
42 |
|
43 |
|
44 |
|
45 |
+
input_ = gr.inputs.Audio(source="microphone", type="file")
|
46 |
+
#input_ = gr.inputs.Audio(source="microphone", type="numpy")
|
47 |
|
48 |
gr.Interface(parse_transcription, inputs = input_, outputs="text",
|
49 |
analytics_enabled=False, show_tips=False, enable_queue=True).launch(inline=False);
|