Spaces:
Sleeping
Sleeping
worldqwq
commited on
Commit
•
9e140e9
1
Parent(s):
e48cdd5
Bug Fixed
Browse filesFormer-commit-id: cf553171866dab3cff19933d2fd4f305511078fa
SRT.py
CHANGED
@@ -97,6 +97,7 @@ class SRT_script():
|
|
97 |
start_seg_id = id_range[0]
|
98 |
end_seg_id = id_range[1]
|
99 |
|
|
|
100 |
if len(lines) != (end_seg_id - start_seg_id + 1):
|
101 |
input_str = "\n";
|
102 |
#initialize GPT input
|
@@ -117,15 +118,15 @@ class SRT_script():
|
|
117 |
temperature=0.15
|
118 |
)
|
119 |
|
120 |
-
translate = response['choices'][0]['
|
121 |
-
|
122 |
|
123 |
#print(id_range)
|
124 |
#for i, seg in enumerate(self.segments[start_seg_id-1:end_seg_id]):
|
125 |
# print(seg.source_text)
|
126 |
#print(translate)
|
127 |
|
128 |
-
|
129 |
|
130 |
for i, seg in enumerate(self.segments[start_seg_id-1:end_seg_id]):
|
131 |
# naive way to due with merge translation problem
|
|
|
97 |
start_seg_id = id_range[0]
|
98 |
end_seg_id = id_range[1]
|
99 |
|
100 |
+
lines = translate.split('\n\n')
|
101 |
if len(lines) != (end_seg_id - start_seg_id + 1):
|
102 |
input_str = "\n";
|
103 |
#initialize GPT input
|
|
|
118 |
temperature=0.15
|
119 |
)
|
120 |
|
121 |
+
translate = response['choices'][0]['message']['content'].strip()
|
122 |
+
lines = translate.split('\n\n')
|
123 |
|
124 |
#print(id_range)
|
125 |
#for i, seg in enumerate(self.segments[start_seg_id-1:end_seg_id]):
|
126 |
# print(seg.source_text)
|
127 |
#print(translate)
|
128 |
|
129 |
+
|
130 |
|
131 |
for i, seg in enumerate(self.segments[start_seg_id-1:end_seg_id]):
|
132 |
# naive way to due with merge translation problem
|