mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2026-06-03 12:18:12 +08:00
Update TTS API to support asynchronous execution by replacing synchronous TTS calls with asynchronous counterparts in both api_v2.py and api_v3.py. Introduce new data classes in unified_engine.py for enhanced request handling and state management, improving overall system performance and maintainability.
This commit is contained in:
parent
d1a97fd04d
commit
6a427b4f54
File diff suppressed because it is too large
Load Diff
@ -221,7 +221,7 @@ async def tts_handle(req: dict):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = tts_engine.run_direct_tts(req)
|
result = await tts_engine.run_direct_tts_async(req)
|
||||||
if result.streaming:
|
if result.streaming:
|
||||||
return StreamingResponse(result.audio_generator, media_type=f"audio/{result.media_type}")
|
return StreamingResponse(result.audio_generator, media_type=f"audio/{result.media_type}")
|
||||||
return Response(result.audio_bytes, media_type=f"audio/{result.media_type}")
|
return Response(result.audio_bytes, media_type=f"audio/{result.media_type}")
|
||||||
|
|||||||
@ -290,7 +290,7 @@ async def tts_handle(req: dict):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = tts_engine.run_direct_tts(req)
|
result = await tts_engine.run_direct_tts_async(req)
|
||||||
if result.streaming:
|
if result.streaming:
|
||||||
return StreamingResponse(result.audio_generator, media_type=f"audio/{result.media_type}")
|
return StreamingResponse(result.audio_generator, media_type=f"audio/{result.media_type}")
|
||||||
return Response(result.audio_bytes, media_type=f"audio/{result.media_type}")
|
return Response(result.audio_bytes, media_type=f"audio/{result.media_type}")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user