Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import asyncio
|
|
5 |
import tempfile
|
6 |
import os
|
7 |
import re # Import the regular expression module
|
|
|
8 |
|
9 |
|
10 |
# Get all available voices
|
@@ -34,7 +35,12 @@ async def paragraph_to_speech(text, voice, rate, pitch):
|
|
34 |
if re.match(r'SS\d+\.?\d*', part):
|
35 |
try:
|
36 |
#silence_duration = float(part[2:])
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
38 |
if os.path.exists(silence_path):
|
39 |
audio_segments.append(silence_path)
|
40 |
else:
|
|
|
5 |
import tempfile
|
6 |
import os
|
7 |
import re # Import the regular expression module
|
8 |
+
from pathlib import Path
|
9 |
|
10 |
|
11 |
# Get all available voices
|
|
|
35 |
if re.match(r'SS\d+\.?\d*', part):
|
36 |
try:
|
37 |
#silence_duration = float(part[2:])
|
38 |
+
# Get the absolute path to Silence.mp3
|
39 |
+
base_dir = Path(__file__).parent.absolute()
|
40 |
+
silence_path = base_dir / "Silence.mp3"
|
41 |
+
print(f"Looking for silence file at: {silence_path}") # Debug output
|
42 |
+
print(f"Directory contents: {os.listdir(base_dir)}") # Debug output
|
43 |
+
#silence_path = os.path.join(os.path.dirname(__file__), "Silence.mp3")
|
44 |
if os.path.exists(silence_path):
|
45 |
audio_segments.append(silence_path)
|
46 |
else:
|