Eason Lu commited on
Commit
007de42
·
1 Parent(s): 19531bb

solve: empty time stamp

Browse files

Former-commit-id: 8f4b494099485ddd0256fbcf7eb99d537826d6ab

Files changed (2) hide show
  1. SRT.py +4 -2
  2. pipeline.py +0 -1
SRT.py CHANGED
@@ -1,6 +1,4 @@
1
  from datetime import timedelta
2
- import os
3
- import whisper
4
  from csv import reader
5
  import re
6
 
@@ -10,6 +8,10 @@ class SRT_segment(object):
10
  segment = args[0]
11
  start_ms = int((segment['start']*100)%100*10)
12
  end_ms = int((segment['end']*100)%100*10)
 
 
 
 
13
  start_time = str(timedelta(seconds=int(segment['start']), milliseconds=start_ms))
14
  end_time = str(timedelta(seconds=int(segment['end']), milliseconds=end_ms))
15
  if start_ms == 0:
 
1
  from datetime import timedelta
 
 
2
  from csv import reader
3
  import re
4
 
 
8
  segment = args[0]
9
  start_ms = int((segment['start']*100)%100*10)
10
  end_ms = int((segment['end']*100)%100*10)
11
+
12
+ if start_ms == end_ms and int(segment['start']) == int(segment['end']): # avoid empty time stamp
13
+ end_ms+=500
14
+
15
  start_time = str(timedelta(seconds=int(segment['start']), milliseconds=start_ms))
16
  end_time = str(timedelta(seconds=int(segment['end']), milliseconds=end_ms))
17
  if start_ms == 0:
pipeline.py CHANGED
@@ -2,7 +2,6 @@ import openai
2
  from pytube import YouTube
3
  import argparse
4
  import os
5
- import whisper
6
  from tqdm import tqdm
7
  from SRT import SRT_script
8
  import stable_whisper
 
2
  from pytube import YouTube
3
  import argparse
4
  import os
 
5
  from tqdm import tqdm
6
  from SRT import SRT_script
7
  import stable_whisper