BoldActionMan
commited on
Commit
•
e8362b5
1
Parent(s):
9558dda
Update app.py
Browse files
app.py
CHANGED
@@ -157,6 +157,19 @@ def process_video(video_file, language_choice):
|
|
157 |
start, end, translated_text = segment
|
158 |
segment_path = os.path.join(output_dir, f'segment_{start}_{end}.wav')
|
159 |
model.tts_to_file(translated_text, speaker_id, segment_path, speed=speed)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
segment_files.append((segment_path, start, end, translated_text))
|
161 |
return segment_files
|
162 |
|
@@ -174,18 +187,7 @@ def process_video(video_file, language_choice):
|
|
174 |
batch_segment_files = list(executor.map(generate_segment_audio_batch, [batch] * len(speaker_ids), [speaker_id] * len(speaker_ids)))
|
175 |
batch_segment_files = [item for sublist in batch_segment_files for item in sublist] # Flatten the list
|
176 |
|
177 |
-
for segment_file, start, end, translated_text in batch_segment_files:
|
178 |
-
reference_speaker = reference_audio[start:end] # This is the voice you want to clone
|
179 |
-
target_se, audio_name = se_extractor.get_se(reference_speaker, tone_color_converter, vad=False)
|
180 |
-
# Run the tone color converter
|
181 |
-
encode_message = "@MyShell"
|
182 |
-
tone_color_converter.convert(
|
183 |
-
audio_src_path=segment_file,
|
184 |
-
src_se=source_se,
|
185 |
-
tgt_se=target_se,
|
186 |
-
output_path=segment_file,
|
187 |
-
message=encode_message
|
188 |
-
)
|
189 |
segment_files.append((segment_file, start, end, translated_text))
|
190 |
|
191 |
# Combine the audio segments
|
|
|
157 |
start, end, translated_text = segment
|
158 |
segment_path = os.path.join(output_dir, f'segment_{start}_{end}.wav')
|
159 |
model.tts_to_file(translated_text, speaker_id, segment_path, speed=speed)
|
160 |
+
|
161 |
+
reference_speaker = reference_audio[start:end] # This is the voice you want to clone
|
162 |
+
target_se, audio_name = se_extractor.get_se(reference_speaker, tone_color_converter, vad=False)
|
163 |
+
# Run the tone color converter
|
164 |
+
encode_message = "@MyShell"
|
165 |
+
tone_color_converter.convert(
|
166 |
+
audio_src_path=segment_path,
|
167 |
+
src_se=source_se,
|
168 |
+
tgt_se=target_se,
|
169 |
+
output_path=segment_path,
|
170 |
+
message=encode_message
|
171 |
+
)
|
172 |
+
|
173 |
segment_files.append((segment_path, start, end, translated_text))
|
174 |
return segment_files
|
175 |
|
|
|
187 |
batch_segment_files = list(executor.map(generate_segment_audio_batch, [batch] * len(speaker_ids), [speaker_id] * len(speaker_ids)))
|
188 |
batch_segment_files = [item for sublist in batch_segment_files for item in sublist] # Flatten the list
|
189 |
|
190 |
+
for segment_file, start, end, translated_text in batch_segment_files:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
191 |
segment_files.append((segment_file, start, end, translated_text))
|
192 |
|
193 |
# Combine the audio segments
|