Kevin676 commited on
Commit
cd6874a
1 Parent(s): 2fd1d88

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -32,7 +32,7 @@ import torchaudio
32
  from speechbrain.pretrained import SpectralMaskEnhancement
33
 
34
  import whisper
35
- model = whisper.load_model("tiny")
36
 
37
  import openai
38
 
@@ -133,15 +133,15 @@ def greet(Text2, audio, Voicetoclone,VoiceMicrophone):
133
  audio = whisper.pad_or_trim(audio)
134
 
135
  # make log-Mel spectrogram and move to the same device as the model
136
- mel = whisper.log_mel_spectrogram(audio).to(model.device)
137
 
138
  # detect the spoken language
139
- _, probs = model.detect_language(mel)
140
  print(f"Detected language: {max(probs, key=probs.get)}")
141
 
142
  # decode the audio
143
  options = whisper.DecodingOptions()
144
- result = whisper.decode(model, mel, options)
145
  res.append(result.text)
146
 
147
  messages = mes
 
32
  from speechbrain.pretrained import SpectralMaskEnhancement
33
 
34
  import whisper
35
+ model1 = whisper.load_model("tiny")
36
 
37
  import openai
38
 
 
133
  audio = whisper.pad_or_trim(audio)
134
 
135
  # make log-Mel spectrogram and move to the same device as the model
136
+ mel = whisper.log_mel_spectrogram(audio).to(model1.device)
137
 
138
  # detect the spoken language
139
+ _, probs = model1.detect_language(mel)
140
  print(f"Detected language: {max(probs, key=probs.get)}")
141
 
142
  # decode the audio
143
  options = whisper.DecodingOptions()
144
+ result = whisper.decode(model1, mel, options)
145
  res.append(result.text)
146
 
147
  messages = mes