Skip to content

Commit

Permalink
Fix tts stop on empty
Browse files Browse the repository at this point in the history
  • Loading branch information
fakhirali committed Jul 12, 2024
1 parent 04d3e2a commit 75bb3ae
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions openvoicechat/tts/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,23 +143,22 @@ def say_multiple_stream(self, text_queue: queue.Queue,
first_sentence = False
else:
continue
if sentence.strip() == '':
break
clean_sentence = remove_words_in_brackets_and_spaces(sentence).strip()
if TIMING and first_audio:
tts_start = monotonic()
output = self.run_tts(clean_sentence)
tts_end = monotonic()
time_diff = tts_end - tts_start
new_row = {'Model': 'TTS', 'Time Taken': time_diff}
new_row_df = pd.DataFrame([new_row])
new_row_df.to_csv('times.csv', mode='a', header=False, index=False)
first_audio = False
else:
output = self.run_tts(clean_sentence)
audio_queue.put((output, clean_sentence))
all_response.append(sentence)
interrupt_text_list.append(clean_sentence)
if sentence.strip() != '': # what is this for?
clean_sentence = remove_words_in_brackets_and_spaces(sentence).strip()
if TIMING and first_audio:
tts_start = monotonic()
output = self.run_tts(clean_sentence)
tts_end = monotonic()
time_diff = tts_end - tts_start
new_row = {'Model': 'TTS', 'Time Taken': time_diff}
new_row_df = pd.DataFrame([new_row])
new_row_df.to_csv('times.csv', mode='a', header=False, index=False)
first_audio = False
else:
output = self.run_tts(clean_sentence)
audio_queue.put((output, clean_sentence))
all_response.append(sentence)
interrupt_text_list.append(clean_sentence)
if self.interrupted:
all_response = self._handle_interruption(interrupt_text_list, interrupt_queue)
self.interrupted = ''
Expand Down

0 comments on commit 75bb3ae

Please sign in to comment.