Delete utils/audio_utils.py
Browse files- utils/audio_utils.py +0 -11
utils/audio_utils.py
DELETED
|
@@ -1,11 +0,0 @@
|
|
| 1 |
-
import whisper
|
| 2 |
-
import tempfile
|
| 3 |
-
|
| 4 |
-
# Transcribe uploaded audio file to text using Whisper
|
| 5 |
-
def transcribe_audio(audio_file) -> str:
|
| 6 |
-
model = whisper.load_model("base")
|
| 7 |
-
with tempfile.NamedTemporaryFile(delete=False, suffix=".mp3") as tmp:
|
| 8 |
-
tmp.write(audio_file.read())
|
| 9 |
-
tmp_path = tmp.name
|
| 10 |
-
result = model.transcribe(tmp_path)
|
| 11 |
-
return result["text"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|