Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -2,24 +2,27 @@ import os
|
|
2 |
|
3 |
import spaces
|
4 |
import torch
|
5 |
-
from transformers import pipeline
|
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-
|
16 |
-
revision = "
|
|
|
|
|
17 |
# model_checkpoint = "oza75/whisper-bambara-asr-001"
|
18 |
# revision = "3578bcb14a42a5d2c58a436fb2c38341898e7885"
|
19 |
-
language = "bambara"
|
|
|
20 |
|
21 |
# Load the custom tokenizer designed for Bambara and the ASR model
|
22 |
-
tokenizer =
|
23 |
pipe = pipeline(model=model_checkpoint, tokenizer=tokenizer, device=device, revision=revision)
|
24 |
|
25 |
|
|
|
2 |
|
3 |
import spaces
|
4 |
import torch
|
5 |
+
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 |
+
#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-004"
|
16 |
+
revision = "84a3491772e7f109198132faa4b793e159d87e0d"
|
17 |
+
#model_checkpoint = "oza75/whisper-bambara-asr-002"
|
18 |
+
# revision = "831cd15ed74a554caac9f304cf50dc773841ba1b"
|
19 |
# model_checkpoint = "oza75/whisper-bambara-asr-001"
|
20 |
# revision = "3578bcb14a42a5d2c58a436fb2c38341898e7885"
|
21 |
+
#language = "bambara"
|
22 |
+
language = "hausa"
|
23 |
|
24 |
# Load the custom tokenizer designed for Bambara and the ASR model
|
25 |
+
tokenizer = WhisperTokenizer.from_pretrained(model_checkpoint, language=language, device=device)
|
26 |
pipe = pipeline(model=model_checkpoint, tokenizer=tokenizer, device=device, revision=revision)
|
27 |
|
28 |
|