Skip to content

Commit 74e27b1

Browse files
authored
Update __init__.py
1 parent fa22d7d commit 74e27b1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pythaiasr/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,12 @@ def __call__(self, file: str) -> str:
6565
input_dict = self.processor(a["input_values"][0], return_tensors="pt", padding=True)
6666
logits = self.model(input_dict.input_values).logits
6767
pred_ids = torch.argmax(logits, dim=-1)[0]
68-
if self.model_name == "airesearch/wav2vec2-large-xlsr-53-th" or self.lm:
68+
if self.model_name == "airesearch/wav2vec2-large-xlsr-53-th":
6969
txt = self.processor.decode(pred_ids)
70-
else:
70+
elif self.lm:
7171
txt = self.processor.batch_decode(logits.detach().numpy()).text[0]
72+
else:
73+
txt = self.processor.decode(pred_ids)
7274
return txt
7375

7476
_model_name = "airesearch/wav2vec2-large-xlsr-53-th"

0 commit comments

Comments
 (0)