Commit
•
c043038
1
Parent(s):
487d42a
Update app.py
Browse files
app.py
CHANGED
@@ -34,14 +34,22 @@ def resampler(input_file_path, output_file_path):
|
|
34 |
def parse_transcription_with_lm(wav_file):
|
35 |
input_values = read_file_and_process(wav_file)
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
with torch.no_grad():
|
38 |
-
logits = model(**input_values).logits
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
print(int_result)
|
44 |
-
transcription = int_result.text.replace('<s>','')
|
45 |
return transcription
|
46 |
|
47 |
|
|
|
34 |
def parse_transcription_with_lm(wav_file):
|
35 |
input_values = read_file_and_process(wav_file)
|
36 |
|
37 |
+
# with torch.no_grad():
|
38 |
+
# logits = model(**input_values).logits[0].cpu().numpy()
|
39 |
+
# print(logits)
|
40 |
+
# int_result = processor_with_LM.decode(logits = logits, output_word_offsets=False,
|
41 |
+
# beam_width=128
|
42 |
+
# )
|
43 |
+
# print(int_result)
|
44 |
+
# transcription = int_result.text.replace('<s>','')
|
45 |
+
|
46 |
+
|
47 |
with torch.no_grad():
|
48 |
+
logits = self.model(**input_values).logits
|
49 |
+
|
50 |
+
result = self.processor.batch_decode(logits.cpu().numpy())
|
51 |
+
text = result.text
|
52 |
+
transcription = text[0]
|
|
|
|
|
53 |
return transcription
|
54 |
|
55 |
|