Update audio_processing.py
Browse files- audio_processing.py +3 -6
audio_processing.py
CHANGED
@@ -4,10 +4,7 @@ import os
|
|
4 |
import tempfile
|
5 |
import edge_tts
|
6 |
|
7 |
-
|
8 |
-
EDGE_TTS_API_KEY = os.environ.get("EDGE_TTS_API_KEY", None) # Không cần API key cho edge-tts
|
9 |
-
|
10 |
-
def text_to_speech(text, voice, language):
|
11 |
"""
|
12 |
Chuyển đổi văn bản thành giọng nói bằng edge-tts.
|
13 |
"""
|
@@ -18,9 +15,9 @@ def text_to_speech(text, voice, language):
|
|
18 |
|
19 |
return output_file.name
|
20 |
|
21 |
-
async def async_text_to_speech(text, voice
|
22 |
"""
|
23 |
Chuyển đổi văn bản thành giọng nói (bất đồng bộ).
|
24 |
"""
|
25 |
loop = asyncio.get_event_loop()
|
26 |
-
return await loop.run_in_executor(None, text_to_speech, text, voice
|
|
|
4 |
import tempfile
|
5 |
import edge_tts
|
6 |
|
7 |
+
def text_to_speech(text, voice):
|
|
|
|
|
|
|
8 |
"""
|
9 |
Chuyển đổi văn bản thành giọng nói bằng edge-tts.
|
10 |
"""
|
|
|
15 |
|
16 |
return output_file.name
|
17 |
|
18 |
+
async def async_text_to_speech(text, voice):
|
19 |
"""
|
20 |
Chuyển đổi văn bản thành giọng nói (bất đồng bộ).
|
21 |
"""
|
22 |
loop = asyncio.get_event_loop()
|
23 |
+
return await loop.run_in_executor(None, text_to_speech, text, voice)
|