Harveenchadha
commited on
Commit
•
06628a1
1
Parent(s):
c03570b
Update app.py
Browse files
app.py
CHANGED
@@ -15,11 +15,11 @@ def get_filename(wav_file):
|
|
15 |
subprocess.call(["sox {} -r {} -b 16 -c 1 {}".format(wav_file, str(16000), filename_new)], shell=True)
|
16 |
return filename_new
|
17 |
|
|
|
|
|
18 |
def parse_transcription(wav_file):
|
19 |
# load pretrained model
|
20 |
-
|
21 |
-
model = Wav2Vec2ForCTC.from_pretrained("Harveenchadha/vakyansh-wav2vec2-hindi-him-4200")
|
22 |
-
|
23 |
# load audio
|
24 |
|
25 |
|
@@ -39,7 +39,10 @@ def parse_transcription(wav_file):
|
|
39 |
transcription = processor.decode(predicted_ids[0], skip_special_tokens=True)
|
40 |
return transcription
|
41 |
|
|
|
|
|
|
|
42 |
|
43 |
input = gr.inputs.Audio(source="microphone", type="file")
|
44 |
gr.Interface(parse_transcription, inputs = input, outputs="text",
|
45 |
-
analytics_enabled=False, show_tips=False).launch(inline=False);
|
|
|
15 |
subprocess.call(["sox {} -r {} -b 16 -c 1 {}".format(wav_file, str(16000), filename_new)], shell=True)
|
16 |
return filename_new
|
17 |
|
18 |
+
|
19 |
+
|
20 |
def parse_transcription(wav_file):
|
21 |
# load pretrained model
|
22 |
+
|
|
|
|
|
23 |
# load audio
|
24 |
|
25 |
|
|
|
39 |
transcription = processor.decode(predicted_ids[0], skip_special_tokens=True)
|
40 |
return transcription
|
41 |
|
42 |
+
|
43 |
+
processor = Wav2Vec2Processor.from_pretrained("Harveenchadha/vakyansh-wav2vec2-hindi-him-4200")
|
44 |
+
model = Wav2Vec2ForCTC.from_pretrained("Harveenchadha/vakyansh-wav2vec2-hindi-him-4200")
|
45 |
|
46 |
input = gr.inputs.Audio(source="microphone", type="file")
|
47 |
gr.Interface(parse_transcription, inputs = input, outputs="text",
|
48 |
+
analytics_enabled=False, show_tips=False, enable_queue=True).launch(inline=False);
|