Spaces:
Runtime error
Runtime error
Update app.py
Browse filesi updated code for time of execution
app.py
CHANGED
@@ -4,6 +4,7 @@ from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor,Wav2Vec2ProcessorWith
|
|
4 |
import gradio as gr
|
5 |
import sox
|
6 |
import subprocess
|
|
|
7 |
|
8 |
|
9 |
def read_file_and_process(wav_file):
|
@@ -36,14 +37,27 @@ def parse_transcription(logits):
|
|
36 |
return transcription
|
37 |
|
38 |
def parse(wav_file, applyLM):
|
|
|
|
|
|
|
39 |
input_values = read_file_and_process(wav_file)
|
40 |
with torch.no_grad():
|
41 |
logits = model(**input_values).logits
|
42 |
|
43 |
-
if applyLM:
|
44 |
-
|
45 |
-
else:
|
46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
|
49 |
model_id = "Harveenchadha/vakyansh-wav2vec2-hindi-him-4200"
|
|
|
4 |
import gradio as gr
|
5 |
import sox
|
6 |
import subprocess
|
7 |
+
import time
|
8 |
|
9 |
|
10 |
def read_file_and_process(wav_file):
|
|
|
37 |
return transcription
|
38 |
|
39 |
def parse(wav_file, applyLM):
|
40 |
+
|
41 |
+
# record start time
|
42 |
+
start = time.time()
|
43 |
input_values = read_file_and_process(wav_file)
|
44 |
with torch.no_grad():
|
45 |
logits = model(**input_values).logits
|
46 |
|
47 |
+
# if applyLM:
|
48 |
+
# return parse_transcription_with_lm(logits)
|
49 |
+
# else:
|
50 |
+
# return parse_transcription(logits)
|
51 |
+
|
52 |
+
output = parse_transcription(logits)
|
53 |
+
# record end time
|
54 |
+
end = time.time()
|
55 |
+
print("------------------------------------------------------------------------------------------")
|
56 |
+
print("The time of execution of above program is :",(end-start) * 10**3, "ms")
|
57 |
+
# total time taken
|
58 |
+
print("Execution time of the program is- ", end-start)
|
59 |
+
print("------------------------------------------------------------------------------------------")
|
60 |
+
return output
|
61 |
|
62 |
|
63 |
model_id = "Harveenchadha/vakyansh-wav2vec2-hindi-him-4200"
|