Spaces:
Runtime error
Runtime error
Add-Vishnu
commited on
Commit
·
fcd6aab
1
Parent(s):
c2c329d
Update asr.py
Browse files
asr.py
CHANGED
@@ -52,14 +52,14 @@ def detect_language(audio):
|
|
52 |
# print(audio)
|
53 |
# inputs_lid = processor_lid(audio, sampling_rate=16_000, return_tensors="pt")
|
54 |
with torch.no_grad():
|
55 |
-
|
56 |
outputs_lid = model_lid(**inputs).logits
|
57 |
end_time = time.time()
|
58 |
# print(end_time-start_time," sec")
|
59 |
lang_id = torch.argmax(outputs_lid, dim=-1)[0].item()
|
60 |
detected_lang = model_lid.config.id2label[lang_id]
|
61 |
print(detected_lang)
|
62 |
-
return detected_lang, (
|
63 |
|
64 |
|
65 |
def transcribe_lang(audio,lang):
|
|
|
52 |
# print(audio)
|
53 |
# inputs_lid = processor_lid(audio, sampling_rate=16_000, return_tensors="pt")
|
54 |
with torch.no_grad():
|
55 |
+
start_time = time.time()
|
56 |
outputs_lid = model_lid(**inputs).logits
|
57 |
end_time = time.time()
|
58 |
# print(end_time-start_time," sec")
|
59 |
lang_id = torch.argmax(outputs_lid, dim=-1)[0].item()
|
60 |
detected_lang = model_lid.config.id2label[lang_id]
|
61 |
print(detected_lang)
|
62 |
+
return detected_lang, (end_time-start_time)
|
63 |
|
64 |
|
65 |
def transcribe_lang(audio,lang):
|