Spaces:
Sleeping
Sleeping
Eason Lu
commited on
Commit
·
a33eef8
1
Parent(s):
5f10ef2
small bug fix but why we have a space?
Browse filesFormer-commit-id: 4ad375c239db8d575a700dc4c76f3acd19aa7b49
- SRT.py +4 -5
- pipeline.py +1 -1
SRT.py
CHANGED
@@ -20,11 +20,12 @@ class SRT_segment(object):
|
|
20 |
self.end_time_str = str(0)+end_time.split('.')[0]+',000'
|
21 |
else:
|
22 |
self.end_time_str = str(0)+end_time.split('.')[0]+','+end_time.split('.')[1][:3]
|
23 |
-
self.source_text = segment['text']
|
24 |
self.duration = f"{self.start_time_str} --> {self.end_time_str}"
|
25 |
self.translation = ""
|
|
|
26 |
elif isinstance(args[0], list):
|
27 |
-
self.source_text = args[0][2]
|
28 |
self.duration = args[0][1]
|
29 |
self.start_time_str = self.duration.split(" --> ")[0]
|
30 |
self.end_time_str = self.duration.split(" --> ")[1]
|
@@ -89,7 +90,7 @@ class SRT_script():
|
|
89 |
segments = []
|
90 |
for idx_list in merge_list:
|
91 |
segments.append(self.merge_segs(idx_list))
|
92 |
-
|
93 |
self.segments = segments # need memory release?
|
94 |
|
95 |
def set_translation(self, translate:str, id_range:tuple):
|
@@ -195,8 +196,6 @@ class SRT_script():
|
|
195 |
else :
|
196 |
ready_words[i]= word + ' '
|
197 |
seg.source_text = re.sub('\n ', '\n', "".join(ready_words))
|
198 |
-
|
199 |
-
print(self)
|
200 |
pass
|
201 |
|
202 |
|
|
|
20 |
self.end_time_str = str(0)+end_time.split('.')[0]+',000'
|
21 |
else:
|
22 |
self.end_time_str = str(0)+end_time.split('.')[0]+','+end_time.split('.')[1][:3]
|
23 |
+
self.source_text = segment['text'][1:]
|
24 |
self.duration = f"{self.start_time_str} --> {self.end_time_str}"
|
25 |
self.translation = ""
|
26 |
+
|
27 |
elif isinstance(args[0], list):
|
28 |
+
self.source_text = args[0][2][:-1]
|
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 |
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):
|
|
|
196 |
else :
|
197 |
ready_words[i]= word + ' '
|
198 |
seg.source_text = re.sub('\n ', '\n', "".join(ready_words))
|
|
|
|
|
199 |
pass
|
200 |
|
201 |
|
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):
|