oza75 commited on
Commit
564acd4
·
verified ·
1 Parent(s): 576f8f4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
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
- #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 = "09c447bfb00b2481b0d9b1d925ce3e6a4c29352a"
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
 
 
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