iam getting this error: FileNotFoundError: [WinError 2] , i dont know if iam just stupid but i know that the file exists using a specific file pathe doenst work thanks for your time and help.code:
import whisper
# Load the Whisper model
model_size = "medium"
model = whisper.load_model(model_size)
# Specify the file path
file_path = "temp_audio.mp3"
# Verify the file path by printing it
print(f"Transcribing file: {file_path}")
# Transcribe the audio file
result = model.transcribe("temp_audio.mp3")
# Print the segments and word-level information
for segment in result["segments"]:
print(f"[{segment['start']:.2f}s -> {segment['end']:.2f}s] {segment['text']}")
# Since word-level timestamps are not directly available,
# we will just collect the text for now.
wordlevel_info = []
for segment in result["segments"]:
words = segment['text'].split()
start = segment['start']
end = segment['end']
duration = (end - start) / len(words) if words else 0
for i, word in enumerate(words):
word_start = start + i * duration
word_end = word_start + duration
wordlevel_info.append({'word': word, 'start': word_start, 'end': word_end})
# Display the collected word-level information
wordlevel_info