MaximilianChen commited on
Commit
b004a55
1 Parent(s): fb3d26f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -1,8 +1,10 @@
1
  from transformers import pipeline
 
2
  import gradio as gr
3
 
4
- model = pipeline(model="MaximilianChen/Casper")
5
-
 
6
 
7
  def transcribe_audio(mic=None, file=None):
8
  if mic is not None:
@@ -11,7 +13,7 @@ def transcribe_audio(mic=None, file=None):
11
  audio = file
12
  else:
13
  return "You must either provide a mic recording or a file"
14
- transcription = model(audio)["text"]
15
  return transcription
16
 
17
 
 
1
  from transformers import pipeline
2
+ from transformers import WhisperProcessor, WhisperForConditionalGeneration
3
  import gradio as gr
4
 
5
+ model = WhisperForConditionalGeneration.from_pretrained("MaximilianChen/Casper")
6
+ processor = WhisperProcessor.from_pretrained('openai/whisper-small', language='catalan', task='transcribe')
7
+ asr = pipeline("automatic-speech-recognition", model=model, pprocessor=processor)
8
 
9
  def transcribe_audio(mic=None, file=None):
10
  if mic is not None:
 
13
  audio = file
14
  else:
15
  return "You must either provide a mic recording or a file"
16
+ transcription = asr(audio)["text"]
17
  return transcription
18
 
19