Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -68,12 +68,12 @@ DEFAULT_TARGET_LANGUAGE = "Bengali"
|
|
68 |
@spaces.GPU
|
69 |
def run_asr_ctc(input_audio: str, target_language: str) -> str:
|
70 |
# preprocess_audio(input_audio)
|
71 |
-
input_audio, orig_freq = torchaudio.load(input_audio)
|
72 |
-
input_audio = torchaudio.functional.resample(input_audio, orig_freq=orig_freq, new_freq=16000)
|
73 |
lang_id = LANGUAGE_NAME_TO_CODE[target_language]
|
74 |
|
75 |
model.cur_decoder = "ctc"
|
76 |
-
ctc_text = model.transcribe([
|
77 |
|
78 |
return ctc_text
|
79 |
|
@@ -85,7 +85,7 @@ def run_asr_rnnt(input_audio: str, target_language: str) -> str:
|
|
85 |
lang_id = LANGUAGE_NAME_TO_CODE[target_language]
|
86 |
|
87 |
model.cur_decoder = "rnnt"
|
88 |
-
ctc_text = model.transcribe([
|
89 |
|
90 |
return ctc_text
|
91 |
|
|
|
68 |
@spaces.GPU
|
69 |
def run_asr_ctc(input_audio: str, target_language: str) -> str:
|
70 |
# preprocess_audio(input_audio)
|
71 |
+
# input_audio, orig_freq = torchaudio.load(input_audio)
|
72 |
+
# input_audio = torchaudio.functional.resample(input_audio, orig_freq=orig_freq, new_freq=16000)
|
73 |
lang_id = LANGUAGE_NAME_TO_CODE[target_language]
|
74 |
|
75 |
model.cur_decoder = "ctc"
|
76 |
+
ctc_text = model.transcribe([input_audio], batch_size=1, logprobs=False, language_id=lang_id)[0]
|
77 |
|
78 |
return ctc_text
|
79 |
|
|
|
85 |
lang_id = LANGUAGE_NAME_TO_CODE[target_language]
|
86 |
|
87 |
model.cur_decoder = "rnnt"
|
88 |
+
ctc_text = model.transcribe([input_audio], batch_size=1,logprobs=False, language_id=lang_id)[0]
|
89 |
|
90 |
return ctc_text
|
91 |
|