From 94f5b781cca476977e131182691192bfcb957a4c Mon Sep 17 00:00:00 2001 From: erew123 <35898566+erew123@users.noreply.github.com> Date: Wed, 27 Dec 2023 06:08:10 +0000 Subject: [PATCH] Update Standalone API - race condition fix Applies the same race condition fix for narrator/character that potentially existed, but for the standalone mode API. Will have zero effect for anyone not using the API --- tts_server.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tts_server.py b/tts_server.py index 9d6e717..d5f3e73 100644 --- a/tts_server.py +++ b/tts_server.py @@ -624,6 +624,7 @@ async def get_audio(filename: str): ######################## import html import re +import uuid import numpy as np import soundfile as sf from typing import Union, Dict @@ -802,7 +803,7 @@ async def tts_generate( print("ELSE - NARRATOR\n") cleaned_part = html.unescape(part.replace('< ', '').replace('< ', '').replace('< ', '')) voice_to_use = narrator_voice_gen - output_file = this_dir / "outputs" / f"{output_file_name}_{int(time.time())}_{i}.wav" + output_file = this_dir / "outputs" / f"{output_file_name}_{uuid.uuid4()}_{int(time.time())}_{i}.wav" output_file_str = output_file.as_posix() await generate_audio(cleaned_part, voice_to_use, language, output_file_str) audio_path = output_file_str