<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>window name</title>
</head>
raise ValidationError('Текст сообщения')
from django.forms import ValidationError
import speech_recognition as sr
from pydub import AudioSegment
import os, sys
from pathlib import Path
def recognition(file_src, file_src2):
AudioSegment.converter = f"{os.getcwd()}\\ffmpeg.exe"
AudioSegment.ffprobe = f"{os.getcwd()}\\ffprobe.exe"
file_src = Path(file_src)
file_src2 = Path(file_src2)
audio = AudioSegment.from_mp3(file_src)
audio.export(file_src2, format="wav")
r = sr.Recognizer()
with sr.AudioFile(open(file_src2, 'rb')) as source:
audio = r.record(source) # read the entire audio file
return r.recognize_google(audio)
print(recognition('captcha_audio5.mp3', 'test.wav'))