Skip to content

Commit

Permalink
Fix ElevenLabs Synthesis Progress
Browse files Browse the repository at this point in the history
Before it wasn't showing the actual progress it was on
  • Loading branch information
ThioJoe committed Jan 19, 2024
1 parent 047bc13 commit f8cc6fc
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Scripts/TTS.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,15 +481,11 @@ async def synthesize_dictionary_async(subsDict, langDict, skipSynthesize=False,
total_tasks = len(subsDict)
errorsOccured = False

print("Beginning TTS Synthesis...")
print("Beginning Text-To-Speech Audio Synthesis...")

async def synthesize_and_save(key, value):
nonlocal progress

# Update and display progress
async with lock:
progress += 1
print(f" Synthesizing TTS: {progress} of {total_tasks}", end="\r")


# Use this to set max concurrent jobs
async with semaphore:
audio = await synthesize_text_elevenlabs_async_http(
Expand All @@ -508,6 +504,11 @@ async def synthesize_and_save(key, value):
errorsOccured = True
subsDict[key]['TTS_FilePath'] = "Failed"

# Update and display progress after task completion
async with lock:
progress += 1
print(f" TTS Progress: {progress} of {total_tasks}", end="\r")

tasks = []

for key, value in subsDict.items():
Expand All @@ -527,6 +528,7 @@ async def synthesize_and_save(key, value):
print("Synthesis Finished")
return subsDict


def synthesize_dictionary(subsDict, langDict, skipSynthesize=False, secondPass=False):
for key, value in subsDict.items():
# TTS each subtitle text, write to file, write filename into dictionary
Expand Down

0 comments on commit f8cc6fc

Please sign in to comment.