oza75 commited on
Commit
6673c70
·
verified ·
1 Parent(s): 88391bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
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-002"
16
- revision = "831cd15ed74a554caac9f304cf50dc773841ba1b"
 
 
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 = BambaraWhisperTokenizer.from_pretrained(model_checkpoint, language=language, device=device)
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