Spaces:
Sleeping
Sleeping
OthmaneLKH
commited on
Commit
•
442ee69
1
Parent(s):
007a343
Update models/speech_to_text/transcriber/model.py
Browse files
models/speech_to_text/transcriber/model.py
CHANGED
@@ -1,4 +1,6 @@
|
|
1 |
from transformers import WhisperProcessor, WhisperForConditionalGeneration
|
|
|
|
|
2 |
|
3 |
def load_model_and_processor(model_name="openai/whisper-base"):
|
4 |
"""
|
@@ -11,6 +13,8 @@ def load_model_and_processor(model_name="openai/whisper-base"):
|
|
11 |
model (WhisperForConditionalGeneration): Loaded Whisper model.
|
12 |
processor (WhisperProcessor): Loaded processor for the model.
|
13 |
"""
|
14 |
-
|
15 |
-
processor =
|
|
|
|
|
16 |
return model, processor
|
|
|
1 |
from transformers import WhisperProcessor, WhisperForConditionalGeneration
|
2 |
+
from transformers import AutoProcessor, AutoModelForSpeechSeq2Seq
|
3 |
+
from transformers import pipeline
|
4 |
|
5 |
def load_model_and_processor(model_name="openai/whisper-base"):
|
6 |
"""
|
|
|
13 |
model (WhisperForConditionalGeneration): Loaded Whisper model.
|
14 |
processor (WhisperProcessor): Loaded processor for the model.
|
15 |
"""
|
16 |
+
|
17 |
+
processor = AutoProcessor.from_pretrained(model_name)
|
18 |
+
model = AutoModelForSpeechSeq2Seq.from_pretrained(model_name)
|
19 |
+
|
20 |
return model, processor
|