Update app.py
Browse files
app.py
CHANGED
@@ -82,21 +82,20 @@ async def generate_audio_with_voice_prefix(text_segment, default_voice, rate, pi
|
|
82 |
current_pitch = -20
|
83 |
current_rate = -10
|
84 |
detect = 1
|
85 |
-
|
86 |
break
|
87 |
#match = re.search(r'([A-Za-z]+)-?(\d+)', processed_text)
|
88 |
-
|
89 |
-
match = re.search(r'([A-Za-z]+)([-]?\d*)', processed_text)
|
90 |
if match:
|
91 |
-
prefix_pitch = match.group(1)
|
92 |
-
number = match.group(
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
|
101 |
if processed_text:
|
102 |
rate_str = f"{current_rate:+d}%"
|
|
|
82 |
current_pitch = -20
|
83 |
current_rate = -10
|
84 |
detect = 1
|
85 |
+
processed_text = processed_text[len(prefix):].strip() #this removes the Prefix and leave only number or text after it.
|
86 |
break
|
87 |
#match = re.search(r'([A-Za-z]+)-?(\d+)', processed_text)
|
88 |
+
match = re.search(r"^(-?\d+)\s*(.*)", processed_text)
|
|
|
89 |
if match:
|
90 |
+
#prefix_pitch = match.group(1)
|
91 |
+
number = match.group(1)
|
92 |
+
print(f"Prefix match found.") # Debug
|
93 |
+
current_pitch += int(number)
|
94 |
+
#processed_text = re.sub(r'[A-Za-z]+-?\d+', '', processed_text, count=1).strip()
|
95 |
+
#processed_text = re.sub(r'([A-Za-z]+)([-]?\d*)', '', processed_text, count=1).strip()
|
96 |
+
processed_text = match.group(2)
|
97 |
+
#elif detect:
|
98 |
+
# processed_text = processed_text.lstrip('-0123456789').strip() # Remove potential leftover numbers
|
99 |
|
100 |
if processed_text:
|
101 |
rate_str = f"{current_rate:+d}%"
|