github-actions[bot] commited on
Commit ·
9722770
1
Parent(s): e64b749
Auto-deploy from GitHub: d4b2676fb5d93be5f45d186b8b3de679dedf66bc
Browse files- app/services/worker.py +20 -4
- tts_results.db +0 -0
app/services/worker.py
CHANGED
|
@@ -78,13 +78,29 @@ async def worker_loop():
|
|
| 78 |
if line_str:
|
| 79 |
logger.info(f"[TTS] {line_str}")
|
| 80 |
|
| 81 |
-
# Parse "
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
if match:
|
| 84 |
current_sentence = int(match.group(1))
|
|
|
|
|
|
|
|
|
|
| 85 |
if total_sentences > 0:
|
| 86 |
-
|
| 87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
# Parse "Combining X audio files"
|
| 90 |
combine_match = re.search(r'Combining\s+(\d+)\s+audio\s+files', line_str)
|
|
|
|
| 78 |
if line_str:
|
| 79 |
logger.info(f"[TTS] {line_str}")
|
| 80 |
|
| 81 |
+
# Parse "Processing X text sentences"
|
| 82 |
+
total_match = re.search(r'Processing\s+(\d+)\s+text\s+sentences', line_str)
|
| 83 |
+
if total_match:
|
| 84 |
+
total_sentences = int(total_match.group(1))
|
| 85 |
+
|
| 86 |
+
# Parse "Sentence X processed" lines (handles both "X" and "X/Y" formats)
|
| 87 |
+
match = re.search(r'Sentence\s+(\d+)(?:/(\d+))?\s+processed', line_str)
|
| 88 |
if match:
|
| 89 |
current_sentence = int(match.group(1))
|
| 90 |
+
if match.group(2):
|
| 91 |
+
total_sentences = int(match.group(2))
|
| 92 |
+
|
| 93 |
if total_sentences > 0:
|
| 94 |
+
# Progress scales from 10% (model loaded) to 90% (start of combining)
|
| 95 |
+
progress = 10 + int((current_sentence / total_sentences) * 80)
|
| 96 |
+
await crud.update_progress(task_id, min(progress, 90), f"Processing sentence {current_sentence}/{total_sentences}")
|
| 97 |
+
|
| 98 |
+
# Parse "Sampling: X%" for granular progress
|
| 99 |
+
sampling_match = re.search(r'Sampling:\s+(\d+)%', line_str)
|
| 100 |
+
if sampling_match and total_sentences > 0:
|
| 101 |
+
sampling_pct = int(sampling_match.group(1))
|
| 102 |
+
progress = 10 + int((current_sentence / total_sentences) * 80) + int((sampling_pct / 100) * (1 / total_sentences) * 80)
|
| 103 |
+
await crud.update_progress(task_id, min(progress, 89), f"Synthesizing sentence {current_sentence + 1}/{total_sentences} ({sampling_pct}%)")
|
| 104 |
|
| 105 |
# Parse "Combining X audio files"
|
| 106 |
combine_match = re.search(r'Combining\s+(\d+)\s+audio\s+files', line_str)
|
tts_results.db
DELETED
|
Binary file (12.3 kB)
|
|
|