JPLTedCas commited on
Commit
2704e98
·
1 Parent(s): 8a70277

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -6,7 +6,10 @@ import time
6
 
7
  from transformers import WhisperProcessor, WhisperForConditionalGeneration
8
  from datasets import load_dataset
9
-
 
 
 
10
  # load model and processor
11
  #processor = WhisperProcessor.from_pretrained("openai/whisper-large-v2")
12
  #model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-large-v2")
@@ -44,9 +47,6 @@ def transcribe(language,audio, state=""):#language="Spanish",
44
  time.sleep(1)
45
  if language=="Multi":
46
  state=""
47
- processor = WhisperProcessor.from_pretrained("openai/whisper-large-v2")
48
- model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-large-v2")
49
- model.config.forced_decoder_ids = None
50
  result = model.transcribe(audio)
51
  text = result["text"]#processor.batch_decode(predicted_ids, skip_special_tokens=False)
52
 
@@ -74,7 +74,7 @@ demo=gr.Interface(
74
 
75
  inputs=[
76
  #gr.Dropdown(["Spanish","Catalan","English", "French", "Japanese"],value="Spanish"),
77
- gr.Dropdown(["Multi"],value="Multi"),
78
 
79
  #gr.Audio(source="microphone", type="filepath", streaming=True),
80
  gr.inputs.Audio(source="microphone", type="filepath"),
 
6
 
7
  from transformers import WhisperProcessor, WhisperForConditionalGeneration
8
  from datasets import load_dataset
9
+ processor = WhisperProcessor.from_pretrained("openai/whisper-large-v2")
10
+ model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-large-v2")
11
+ model.config.forced_decoder_ids = None
12
+
13
  # load model and processor
14
  #processor = WhisperProcessor.from_pretrained("openai/whisper-large-v2")
15
  #model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-large-v2")
 
47
  time.sleep(1)
48
  if language=="Multi":
49
  state=""
 
 
 
50
  result = model.transcribe(audio)
51
  text = result["text"]#processor.batch_decode(predicted_ids, skip_special_tokens=False)
52
 
 
74
 
75
  inputs=[
76
  #gr.Dropdown(["Spanish","Catalan","English", "French", "Japanese"],value="Spanish"),
77
+ gr.Dropdown(["Multi","Spanish"],value="Multi"),
78
 
79
  #gr.Audio(source="microphone", type="filepath", streaming=True),
80
  gr.inputs.Audio(source="microphone", type="filepath"),