DevangMahesh commited on
Commit
a83e4c6
·
1 Parent(s): 2665e6f

Hoping this will add pause

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -230,9 +230,10 @@ def transcribe_audio(audio_path: str) -> str:
230
  return "I'm sorry, I couldn't understand the audio message."
231
 
232
  def convert_text_to_mp3(text, mp3_name = '/tmp/amy_said.mp3'):
 
233
  text = re.sub(r"\*[^*]+\*", " ", text)
234
  text = re.sub(r'[^A-Za-z0-9.,$ \'?]+', " ", text)
235
- text = re.sub(r'\n', ".", text) #To add pause need to add period and not space
236
  text = text.encode('cp1252', 'ignore').decode('cp1252')
237
  if text.isspace() or text == "":
238
  return None
 
230
  return "I'm sorry, I couldn't understand the audio message."
231
 
232
  def convert_text_to_mp3(text, mp3_name = '/tmp/amy_said.mp3'):
233
+ text = re.sub(r':', ". ", text) #To add pause need to add period and not space
234
  text = re.sub(r"\*[^*]+\*", " ", text)
235
  text = re.sub(r'[^A-Za-z0-9.,$ \'?]+', " ", text)
236
+ text = re.sub(r'\n', ". ", text) #To add pause need to add period and not space
237
  text = text.encode('cp1252', 'ignore').decode('cp1252')
238
  if text.isspace() or text == "":
239
  return None