fix: import edge_tts 在函数中引入
This commit is contained in:
parent
7f9e2ad616
commit
74ece85b0a
|
@ -3,7 +3,6 @@ from django.conf import settings
|
||||||
import uuid
|
import uuid
|
||||||
import os
|
import os
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
import edge_tts
|
|
||||||
from asgiref.sync import async_to_sync
|
from asgiref.sync import async_to_sync
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,6 +33,7 @@ def generate_voice(msg: str, per: int = 0):
|
||||||
f.write(result)
|
f.write(result)
|
||||||
return True, path + file_name, None
|
return True, path + file_name, None
|
||||||
elif getattr(settings, 'EDGE_TTS_ENABLED', False):
|
elif getattr(settings, 'EDGE_TTS_ENABLED', False):
|
||||||
|
import edge_tts
|
||||||
if per == 0:
|
if per == 0:
|
||||||
per = 'zh-CN-XiaoxiaoNeural'
|
per = 'zh-CN-XiaoxiaoNeural'
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue