fix
This commit is contained in:
parent
cfb26d057f
commit
83595402b7
|
@ -12,5 +12,5 @@ class WhisperTranscriber:
|
|||
print("Whisper model loaded.")
|
||||
|
||||
def transcribe(self, audio_file: str) -> str:
|
||||
result = self.pipe(audio_file)
|
||||
result = self.pipe(audio_file, return_timestamps=True)
|
||||
return result.get("text", "").strip()
|
||||
|
|
|
@ -51,10 +51,15 @@ async def handle_voice_and_video(message: types.Message, redis_service, storage_
|
|||
message_id=message.message_id
|
||||
)
|
||||
if text:
|
||||
await message.reply(f"{text}")
|
||||
await send_long_message(message, text)
|
||||
else:
|
||||
await message.reply("Sorry, transcription result was not received within the timeout.")
|
||||
|
||||
async def send_long_message(message: types.Message, text: str):
|
||||
"""Отправляет длинный текст, разбивая его на части по 4096 символов"""
|
||||
chunk_size = 4096
|
||||
for i in range(0, len(text), chunk_size):
|
||||
await message.reply(text[i : i + chunk_size])
|
||||
|
||||
def convert_to_wav(input_file: str, output_file: str):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue