Update app.py
Browse files
app.py
CHANGED
@@ -102,16 +102,16 @@ def evaluate(
|
|
102 |
audio = whisper.load_audio(audio)
|
103 |
audio = whisper.pad_or_trim(audio)
|
104 |
|
105 |
-
# make log-Mel spectrogram and move to the same device as the
|
106 |
-
mel = whisper.log_mel_spectrogram(audio).to(
|
107 |
|
108 |
# detect the spoken language
|
109 |
-
_, probs =
|
110 |
print(f"Detected language: {max(probs, key=probs.get)}")
|
111 |
|
112 |
# decode the audio
|
113 |
options = whisper.DecodingOptions()
|
114 |
-
result = whisper.decode(
|
115 |
|
116 |
instruction = result.text
|
117 |
|
|
|
102 |
audio = whisper.load_audio(audio)
|
103 |
audio = whisper.pad_or_trim(audio)
|
104 |
|
105 |
+
# make log-Mel spectrogram and move to the same device as the model1
|
106 |
+
mel = whisper.log_mel_spectrogram(audio).to(model1.device)
|
107 |
|
108 |
# detect the spoken language
|
109 |
+
_, probs = model1.detect_language(mel)
|
110 |
print(f"Detected language: {max(probs, key=probs.get)}")
|
111 |
|
112 |
# decode the audio
|
113 |
options = whisper.DecodingOptions()
|
114 |
+
result = whisper.decode(model1, mel, options)
|
115 |
|
116 |
instruction = result.text
|
117 |
|