fix: import edge_tts 在函数中引入

This commit is contained in:
zty 2024-10-09 10:00:46 +08:00
parent 7f9e2ad616
commit 74ece85b0a
1 changed files with 1 additions and 1 deletions

View File

@ -3,7 +3,6 @@ from django.conf import settings
import uuid
import os
from django.utils import timezone
import edge_tts
from asgiref.sync import async_to_sync
@ -34,6 +33,7 @@ def generate_voice(msg: str, per: int = 0):
f.write(result)
return True, path + file_name, None
elif getattr(settings, 'EDGE_TTS_ENABLED', False):
import edge_tts
if per == 0:
per = 'zh-CN-XiaoxiaoNeural'
else: