Spaces:
Runtime error
Runtime error
Commit ·
2a9c85c
1
Parent(s): f3a3a4e
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import whisper
|
|
| 4 |
import gradio as gr
|
| 5 |
from transformers import pipeline
|
| 6 |
|
| 7 |
-
transcription_model = whisper.load_model("small
|
| 8 |
|
| 9 |
def transcribe(audio):
|
| 10 |
|
|
@@ -17,8 +17,8 @@ def transcribe(audio):
|
|
| 17 |
mel = whisper.log_mel_spectrogram(audio).to(transcription_model.device)
|
| 18 |
|
| 19 |
# detect the spoken language
|
| 20 |
-
|
| 21 |
-
|
| 22 |
|
| 23 |
# decode the audio
|
| 24 |
options = whisper.DecodingOptions(fp16 = False)
|
|
|
|
| 4 |
import gradio as gr
|
| 5 |
from transformers import pipeline
|
| 6 |
|
| 7 |
+
transcription_model = whisper.load_model("small")
|
| 8 |
|
| 9 |
def transcribe(audio):
|
| 10 |
|
|
|
|
| 17 |
mel = whisper.log_mel_spectrogram(audio).to(transcription_model.device)
|
| 18 |
|
| 19 |
# detect the spoken language
|
| 20 |
+
_, probs = transcription_model.detect_language(mel)
|
| 21 |
+
print(f"Detected language: {max(probs, key=probs.get)}")
|
| 22 |
|
| 23 |
# decode the audio
|
| 24 |
options = whisper.DecodingOptions(fp16 = False)
|