cnph001 commited on
Commit
affede7
·
verified ·
1 Parent(s): 6422c1f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -150,7 +150,7 @@ async def generate_audio_with_voice_prefix(text_segment, default_voice, rate, pi
150
  processed_text = new_text[len(prefix):] # Dynamically remove the prefix part
151
  else:
152
  if detect:
153
- processed_text = processed_tex[2:]
154
  if processed_text:
155
  rate_str = f"{current_rate:+d}%"
156
  pitch_str = f"{current_pitch:+d}Hz"
@@ -173,8 +173,9 @@ async def process_transcript_line(line, default_voice, rate, pitch):
173
  int(milliseconds)
174
  )
175
  audio_segments = []
176
- split_parts = re.split(r'(")', text_parts) # Split by quote marks, keeping the quotes
177
-
 
178
  process_next = False
179
  for part in split_parts:
180
  if part == '"':
@@ -249,7 +250,7 @@ async def create_demo():
249
  Example:
250
  ```
251
  00:00:00.000 "This is the default voice." more default. "1F Now a female voice." and back to default.
252
- 00:00:05.000 "1C Yes," said the child, "it is fun!"
253
  ```
254
  ***************************************************************************************************
255
  1M = en-AU-WilliamNeural - en-AU (Male)
 
150
  processed_text = new_text[len(prefix):] # Dynamically remove the prefix part
151
  else:
152
  if detect:
153
+ processed_text = processed_text[2:].strip()
154
  if processed_text:
155
  rate_str = f"{current_rate:+d}%"
156
  pitch_str = f"{current_pitch:+d}Hz"
 
173
  int(milliseconds)
174
  )
175
  audio_segments = []
176
+ #split_parts = re.split(r'(")', text_parts) # Split by quote marks, keeping the quotes
177
+ split_parts = re.split(r'[“”"]', text_parts) # Split by quote marks, keeping the quotes
178
+ #paragraphs = [p.strip() for p in re.split(r'[“”"]', text) if p.strip()]
179
  process_next = False
180
  for part in split_parts:
181
  if part == '"':
 
250
  Example:
251
  ```
252
  00:00:00.000 "This is the default voice." more default. "1F Now a female voice." and back to default.
253
+ 00:00:10.000 "1C Yes," said the child, "it is fun!"
254
  ```
255
  ***************************************************************************************************
256
  1M = en-AU-WilliamNeural - en-AU (Male)