diff --git a/main.py b/main.py index b970efd..f5049b7 100644 --- a/main.py +++ b/main.py @@ -92,7 +92,10 @@ async def on_audio_end(elements: list[ElementBased]): with open(file_path, "wb") as f: f.write(audio_buffer.read()) - result = funasr.transcribe(file_path) + # Use run_in_executor to avoid blocking the async event loop + loop = asyncio.get_event_loop() + result = await loop.run_in_executor(None, funasr.transcribe, file_path) + await cl.Message( content=result, type="user_message",