Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -609,7 +609,7 @@ def add_transcript_voiceover(video_path, translated_json, output_path, process_m
|
|
| 609 |
|
| 610 |
with concurrent.futures.ThreadPoolExecutor() as executor:
|
| 611 |
futures = [executor.submit(process_entry, entry, i, tts_model, video.w, video.h, process_mode, target_language, font_path, speaker_sample_paths)
|
| 612 |
-
for i, entry in enumerate(
|
| 613 |
|
| 614 |
results = []
|
| 615 |
for future in concurrent.futures.as_completed(futures):
|
|
@@ -837,14 +837,14 @@ def upload_and_manage(file, target_language, process_mode):
|
|
| 837 |
# Step 2: Translate the transcription
|
| 838 |
logger.info(f"Translating transcription from {source_language} to {target_language}...")
|
| 839 |
translated_json_raw = translate_text(transcription_json, source_language, target_language)
|
| 840 |
-
logger.info(f"Translation completed. Number of translated segments: {len(
|
| 841 |
|
| 842 |
# translated_json = post_edit_translated_segments(translated_json, file.name)
|
| 843 |
translated_json = apply_adaptive_speed(translated_json_raw, source_language, target_language)
|
| 844 |
|
| 845 |
# Step 3: Add transcript to video based on timestamps
|
| 846 |
logger.info("Adding translated transcript to video...")
|
| 847 |
-
add_transcript_voiceover(file.name,
|
| 848 |
logger.info(f"Transcript added to video. Output video saved at {output_video_path}")
|
| 849 |
|
| 850 |
# Convert translated JSON into a format for the editable table
|
|
|
|
| 609 |
|
| 610 |
with concurrent.futures.ThreadPoolExecutor() as executor:
|
| 611 |
futures = [executor.submit(process_entry, entry, i, tts_model, video.w, video.h, process_mode, target_language, font_path, speaker_sample_paths)
|
| 612 |
+
for i, entry in enumerate(translated_json)]
|
| 613 |
|
| 614 |
results = []
|
| 615 |
for future in concurrent.futures.as_completed(futures):
|
|
|
|
| 837 |
# Step 2: Translate the transcription
|
| 838 |
logger.info(f"Translating transcription from {source_language} to {target_language}...")
|
| 839 |
translated_json_raw = translate_text(transcription_json, source_language, target_language)
|
| 840 |
+
logger.info(f"Translation completed. Number of translated segments: {len(translated_json_raw)}")
|
| 841 |
|
| 842 |
# translated_json = post_edit_translated_segments(translated_json, file.name)
|
| 843 |
translated_json = apply_adaptive_speed(translated_json_raw, source_language, target_language)
|
| 844 |
|
| 845 |
# Step 3: Add transcript to video based on timestamps
|
| 846 |
logger.info("Adding translated transcript to video...")
|
| 847 |
+
add_transcript_voiceover(file.name, translated_json, output_video_path, process_mode, target_language)
|
| 848 |
logger.info(f"Transcript added to video. Output video saved at {output_video_path}")
|
| 849 |
|
| 850 |
# Convert translated JSON into a format for the editable table
|