Files
encoach_backend/testing.py
Cristiano Ferreira d1bac041c7 add playgrounds
2023-05-08 09:27:24 +01:00

13 lines
373 B
Python

import whisper
import os
from pydub import AudioSegment
model = whisper.load_model("base")
file_path = "audio-samples/mynameisjeff.wav"
audio_file = AudioSegment.from_file(file_path)
if os.path.exists(file_path):
result = model.transcribe(file_path, fp16=False, language='English', verbose=True)
print(result["text"])
else:
print("File not found:", file_path)