Spaces:
Sleeping
Sleeping
Eason Lu
commited on
Commit
·
da02d45
1
Parent(s):
843c130
small bug fix but why we have a space?
Browse filesFormer-commit-id: edf21e8ea437237fc239a861f8b3a8c90950c414
- SRT.py +4 -5
- pipeline.py +1 -1
SRT.py
CHANGED
@@ -21,11 +21,12 @@ class SRT_segment(object):
|
|
21 |
self.end_time_str = str(0)+end_time.split('.')[0]+',000'
|
22 |
else:
|
23 |
self.end_time_str = str(0)+end_time.split('.')[0]+','+end_time.split('.')[1][:3]
|
24 |
-
self.source_text = segment['text']
|
25 |
self.duration = f"{self.start_time_str} --> {self.end_time_str}"
|
26 |
self.translation = ""
|
|
|
27 |
elif isinstance(args[0], list):
|
28 |
-
self.source_text = args[0][2]
|
29 |
self.duration = args[0][1]
|
30 |
self.start_time_str = self.duration.split(" --> ")[0]
|
31 |
self.end_time_str = self.duration.split(" --> ")[1]
|
@@ -90,7 +91,7 @@ class SRT_script():
|
|
90 |
segments = []
|
91 |
for idx_list in merge_list:
|
92 |
segments.append(self.merge_segs(idx_list))
|
93 |
-
|
94 |
self.segments = segments # need memory release?
|
95 |
|
96 |
def set_translation(self, translate:str, id_range:tuple):
|
@@ -223,8 +224,6 @@ class SRT_script():
|
|
223 |
else :
|
224 |
ready_words[i]= word + ' '
|
225 |
seg.source_text = re.sub('\n ', '\n', "".join(ready_words))
|
226 |
-
|
227 |
-
print(self)
|
228 |
pass
|
229 |
|
230 |
|
|
|
21 |
self.end_time_str = str(0)+end_time.split('.')[0]+',000'
|
22 |
else:
|
23 |
self.end_time_str = str(0)+end_time.split('.')[0]+','+end_time.split('.')[1][:3]
|
24 |
+
self.source_text = segment['text'][1:]
|
25 |
self.duration = f"{self.start_time_str} --> {self.end_time_str}"
|
26 |
self.translation = ""
|
27 |
+
|
28 |
elif isinstance(args[0], list):
|
29 |
+
self.source_text = args[0][2][:-1]
|
30 |
self.duration = args[0][1]
|
31 |
self.start_time_str = self.duration.split(" --> ")[0]
|
32 |
self.end_time_str = self.duration.split(" --> ")[1]
|
|
|
91 |
segments = []
|
92 |
for idx_list in merge_list:
|
93 |
segments.append(self.merge_segs(idx_list))
|
94 |
+
|
95 |
self.segments = segments # need memory release?
|
96 |
|
97 |
def set_translation(self, translate:str, id_range:tuple):
|
|
|
224 |
else :
|
225 |
ready_words[i]= word + ' '
|
226 |
seg.source_text = re.sub('\n ', '\n', "".join(ready_words))
|
|
|
|
|
227 |
pass
|
228 |
|
229 |
|
pipeline.py
CHANGED
@@ -134,7 +134,7 @@ if not args.only_srt:
|
|
134 |
from srt2ass import srt2ass
|
135 |
assSub_en = srt2ass(srt_file_en, "default", "No", "Modest")
|
136 |
print('ASS subtitle saved as: ' + assSub_en)
|
137 |
-
|
138 |
|
139 |
# Split the video script by sentences and create chunks within the token limit
|
140 |
def script_split(script_in, chunk_size = 1000):
|
|
|
134 |
from srt2ass import srt2ass
|
135 |
assSub_en = srt2ass(srt_file_en, "default", "No", "Modest")
|
136 |
print('ASS subtitle saved as: ' + assSub_en)
|
137 |
+
|
138 |
|
139 |
# Split the video script by sentences and create chunks within the token limit
|
140 |
def script_split(script_in, chunk_size = 1000):
|