NeuralFalcon commited on
Commit
6914ff7
·
verified ·
1 Parent(s): a85ab86

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -167,7 +167,9 @@ def word_level_srt(words_timestamp, srt_path="world_level_subtitle.srt"):
167
  for i, word_info in enumerate(words_timestamp, start=1):
168
  start_time = convert_time_to_srt_format(word_info['start'])
169
  end_time = convert_time_to_srt_format(word_info['end'])
170
- srt_file.write(f"{i}\n{start_time} --> {end_time}\n{word_info['word']}\n\n")
 
 
171
 
172
  def generate_srt_from_sentences(sentence_timestamp, srt_path="default_subtitle.srt"):
173
  with open(srt_path, 'w', encoding='utf-8') as srt_file:
 
167
  for i, word_info in enumerate(words_timestamp, start=1):
168
  start_time = convert_time_to_srt_format(word_info['start'])
169
  end_time = convert_time_to_srt_format(word_info['end'])
170
+ word=word_info['word']
171
+ word = re.sub(r'[.,!?]+$', '', word)
172
+ srt_file.write(f"{i}\n{start_time} --> {end_time}\n{word}\n\n")
173
 
174
  def generate_srt_from_sentences(sentence_timestamp, srt_path="default_subtitle.srt"):
175
  with open(srt_path, 'w', encoding='utf-8') as srt_file: