Spaces:
Runtime error
Runtime error
Update asr.py
Browse files
asr.py
CHANGED
|
@@ -4,11 +4,11 @@ import numpy as np
|
|
| 4 |
import langid # Language detection library
|
| 5 |
from transformers import Wav2Vec2ForCTC, AutoProcessor
|
| 6 |
|
| 7 |
-
#ASR_SAMPLING_RATE = 16_000
|
| 8 |
-
#MODEL_ID = "facebook/mms-1b-all"
|
| 9 |
-
# openai/whisper-large-v3-turbo
|
| 10 |
ASR_SAMPLING_RATE = 16_000
|
| 11 |
-
MODEL_ID = "
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
# Load MMS Model
|
| 14 |
processor = AutoProcessor.from_pretrained(MODEL_ID)
|
|
@@ -59,4 +59,5 @@ def transcribe_auto(audio_data=None):
|
|
| 59 |
ids = torch.argmax(outputs, dim=-1)[0]
|
| 60 |
final_transcription = processor.decode(ids)
|
| 61 |
|
| 62 |
-
|
|
|
|
|
|
| 4 |
import langid # Language detection library
|
| 5 |
from transformers import Wav2Vec2ForCTC, AutoProcessor
|
| 6 |
|
|
|
|
|
|
|
|
|
|
| 7 |
ASR_SAMPLING_RATE = 16_000
|
| 8 |
+
MODEL_ID = "facebook/mms-1b-all"
|
| 9 |
+
# openai/whisper-large-v3-turbo
|
| 10 |
+
#ASR_SAMPLING_RATE = 16_000
|
| 11 |
+
#MODEL_ID = "openai/whisper-large-v3-turbo"
|
| 12 |
|
| 13 |
# Load MMS Model
|
| 14 |
processor = AutoProcessor.from_pretrained(MODEL_ID)
|
|
|
|
| 59 |
ids = torch.argmax(outputs, dim=-1)[0]
|
| 60 |
final_transcription = processor.decode(ids)
|
| 61 |
|
| 62 |
+
# return f"Detected Language: {detected_lang.upper()}\n\nTranscription:\n{final_transcription}"
|
| 63 |
+
return f"{final_transcription}"
|