Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -6,23 +6,21 @@ from transformers import pipeline, WhisperTokenizer
|
|
6 |
import gradio as gr
|
7 |
# Please note that the below import will override whisper LANGUAGES to add bambara
|
8 |
# this is not the best way to do it but at least it works. for more info check the bambara_utils code
|
9 |
-
|
10 |
|
11 |
# Determine the appropriate device (GPU or CPU)
|
12 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
13 |
|
14 |
# Define the model checkpoint and language
|
15 |
-
model_checkpoint = "oza75/whisper-bambara-asr-
|
16 |
-
revision = "
|
17 |
-
#model_checkpoint = "oza75/whisper-bambara-asr-002"
|
18 |
-
# revision = "831cd15ed74a554caac9f304cf50dc773841ba1b"
|
19 |
# model_checkpoint = "oza75/whisper-bambara-asr-001"
|
20 |
# revision = "3578bcb14a42a5d2c58a436fb2c38341898e7885"
|
21 |
-
|
22 |
-
|
23 |
|
24 |
# Load the custom tokenizer designed for Bambara and the ASR model
|
25 |
-
tokenizer =
|
26 |
pipe = pipeline(model=model_checkpoint, tokenizer=tokenizer, device=device, revision=revision)
|
27 |
|
28 |
|
|
|
6 |
import gradio as gr
|
7 |
# Please note that the below import will override whisper LANGUAGES to add bambara
|
8 |
# this is not the best way to do it but at least it works. for more info check the bambara_utils code
|
9 |
+
from bambara_utils import BambaraWhisperTokenizer
|
10 |
|
11 |
# Determine the appropriate device (GPU or CPU)
|
12 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
13 |
|
14 |
# Define the model checkpoint and language
|
15 |
+
model_checkpoint = "oza75/whisper-bambara-asr-002"
|
16 |
+
revision = "831cd15ed74a554caac9f304cf50dc773841ba1b"
|
|
|
|
|
17 |
# model_checkpoint = "oza75/whisper-bambara-asr-001"
|
18 |
# revision = "3578bcb14a42a5d2c58a436fb2c38341898e7885"
|
19 |
+
language = "bambara"
|
20 |
+
|
21 |
|
22 |
# Load the custom tokenizer designed for Bambara and the ASR model
|
23 |
+
tokenizer = BambaraWhisperTokenizer.from_pretrained(model_checkpoint, language=language, device=device)
|
24 |
pipe = pipeline(model=model_checkpoint, tokenizer=tokenizer, device=device, revision=revision)
|
25 |
|
26 |
|