thak123 commited on
Commit
dfc9440
1 Parent(s): 2c6d161

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -1,19 +1,19 @@
1
  from transformers import WhisperTokenizer
2
 
3
- tokenizer = WhisperTokenizer.from_pretrained("openai/whisper-small", language="marathi", task="transcribe")
4
 
5
  from transformers import pipeline
6
  import gradio as gr
7
  import torch
8
 
9
- pipe = pipeline(model="thak123/whisper-small-LDC-V1.1", #"thak123/whisper-small-gom",
10
  task="automatic-speech-recognition", tokenizer= tokenizer) # change to "your-username/the-name-you-picked"
11
 
12
- pipe.model.config.forced_decoder_ids = (
13
- pipe.tokenizer.get_decoder_prompt_ids(
14
- language="marathi", task="transcribe"
15
- )
16
- )
17
 
18
  def transcribe(audio):
19
  text = pipe(audio)["text"]
@@ -23,6 +23,11 @@ iface = gr.Interface(
23
  fn=transcribe,
24
  inputs=gr.Audio(source="microphone", type="filepath"),
25
  outputs="text",
 
 
 
 
 
26
  title="Whisper Small Konkani",
27
  description="Realtime demo for Konkani speech recognition using a fine-tuned Whisper small model.",
28
  )
 
1
  from transformers import WhisperTokenizer
2
 
3
+ tokenizer = WhisperTokenizer.from_pretrained("openai/whisper-small") #, language="marathi", task="transcribe"
4
 
5
  from transformers import pipeline
6
  import gradio as gr
7
  import torch
8
 
9
+ pipe = pipeline(model="thak123/whisper-small-LDC-V1", #"thak123/whisper-small-gom",
10
  task="automatic-speech-recognition", tokenizer= tokenizer) # change to "your-username/the-name-you-picked"
11
 
12
+ # pipe.model.config.forced_decoder_ids = (
13
+ # pipe.tokenizer.get_decoder_prompt_ids(
14
+ # language="marathi", task="transcribe"
15
+ # )
16
+ # )
17
 
18
  def transcribe(audio):
19
  text = pipe(audio)["text"]
 
23
  fn=transcribe,
24
  inputs=gr.Audio(source="microphone", type="filepath"),
25
  outputs="text",
26
+ examples=[
27
+ [os.path.join(os.path.dirname("."),"audio/chalyaami.mp3")],
28
+ [os.path.join(os.path.dirname("."),"audio/ekdonteen.flac")],
29
+ [os.path.join(os.path.dirname("."),"audio/heyatachadjaale.mp3")],
30
+ ],
31
  title="Whisper Small Konkani",
32
  description="Realtime demo for Konkani speech recognition using a fine-tuned Whisper small model.",
33
  )