Spaces:
Runtime error
Runtime error
Improves audio to text by using the transcribe function
Browse files- core/audio.py +2 -5
core/audio.py
CHANGED
@@ -16,10 +16,7 @@ def audio_to_text(model, audio_file):
|
|
16 |
audio.export("audio_tmp")
|
17 |
try:
|
18 |
audio = whisper.load_audio("audio_tmp")
|
19 |
-
|
20 |
-
mel = whisper.log_mel_spectrogram(audio).to(model.device)
|
21 |
-
options = whisper.DecodingOptions()
|
22 |
-
result = whisper.decode(model, mel, options)
|
23 |
finally:
|
24 |
os.remove("audio_tmp")
|
25 |
-
return result
|
|
|
16 |
audio.export("audio_tmp")
|
17 |
try:
|
18 |
audio = whisper.load_audio("audio_tmp")
|
19 |
+
result = whisper.transcribe(model=model, audio=audio, verbose=True)
|
|
|
|
|
|
|
20 |
finally:
|
21 |
os.remove("audio_tmp")
|
22 |
+
return result["text"]
|