use to_thread for deleting video files

This commit is contained in:
thedragonsinn
2024-04-20 20:31:04 +05:30
parent 832ce18493
commit 8b1e026c60

View File

@@ -206,7 +206,7 @@ async def handle_video(prompt: str, message: Message):
response_text = get_response_text(response)
for uploaded_frame in uploaded_frames:
genai.delete_file(name=uploaded_frame.name)
await asyncio.to_thread(genai.delete_file, name=uploaded_frame.name)
shutil.rmtree(download_dir, ignore_errors=True)
return response_text