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
This commit is contained in:
erew123 authored and GitHub committed 2023-12-27 06:08:10 +00:00
1 parent f83e7c3b4e
commit 94f5b781cc
1 file changed
+2 -1
+2 -1
View File
@@ -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