mirror of
https://github.com/remsky/Kokoro-FastAPI.git
synced 2025-04-13 09:39:17 +00:00
fixed: async scandir finding voices
This commit is contained in:
parent
89bec47b0b
commit
e7ffcf49f5
1 changed files with 5 additions and 5 deletions
|
@ -252,15 +252,15 @@ class TTSService:
|
||||||
if not isinstance(e, (ValueError, RuntimeError)):
|
if not isinstance(e, (ValueError, RuntimeError)):
|
||||||
raise RuntimeError(f"Error combining voices: {str(e)}")
|
raise RuntimeError(f"Error combining voices: {str(e)}")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
async def list_voices(self) -> List[str]:
|
async def list_voices(self) -> List[str]:
|
||||||
"""List all available voices"""
|
"""List all available voices"""
|
||||||
voices = []
|
voices = []
|
||||||
try:
|
try:
|
||||||
async with aiofiles.scandir(TTSModel.VOICES_DIR) as it:
|
it = await aiofiles.os.scandir(TTSModel.VOICES_DIR)
|
||||||
async for entry in it:
|
for entry in it:
|
||||||
if entry.name.endswith(".pt"):
|
if entry.name.endswith(".pt"):
|
||||||
voices.append(entry.name[:-3]) # Remove .pt extension
|
voices.append(entry.name[:-3]) # Remove .pt extension
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error listing voices: {str(e)}")
|
logger.error(f"Error listing voices: {str(e)}")
|
||||||
return sorted(voices)
|
return sorted(voices)
|
||||||
|
|
Loading…
Add table
Reference in a new issue