Update app.py
Browse files
app.py
CHANGED
|
@@ -80,9 +80,9 @@ def translate_text(transcription_json, target_language):
|
|
| 80 |
"translated": translated_text,
|
| 81 |
"end": entry["end"]
|
| 82 |
})
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
|
| 87 |
# Return the translated timestamps as a JSON string
|
| 88 |
return json.dumps(translated_json, indent=4)
|
|
@@ -94,6 +94,10 @@ def add_transcript_to_video(video_path, translated_json, output_path):
|
|
| 94 |
# Create text clips based on timestamps
|
| 95 |
text_clips = []
|
| 96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
for entry in translated_json:
|
| 98 |
# Ensure `entry` is a dictionary with keys "start", "end", and "translated"
|
| 99 |
if isinstance(entry, dict) and "translated" in entry:
|
|
|
|
| 80 |
"translated": translated_text,
|
| 81 |
"end": entry["end"]
|
| 82 |
})
|
| 83 |
+
# Log the components being added to translated_json
|
| 84 |
+
logger.debug("Adding to translated_json: start=%s, original=%s, translated=%s, end=%s",
|
| 85 |
+
entry["start"], original_text, translated_text, entry["end"])
|
| 86 |
|
| 87 |
# Return the translated timestamps as a JSON string
|
| 88 |
return json.dumps(translated_json, indent=4)
|
|
|
|
| 94 |
# Create text clips based on timestamps
|
| 95 |
text_clips = []
|
| 96 |
|
| 97 |
+
logger.debug("Full translated_json: %s", translated_json)
|
| 98 |
+
for entry in translated_json:
|
| 99 |
+
logger.debug("Processing entry: %s", entry)
|
| 100 |
+
|
| 101 |
for entry in translated_json:
|
| 102 |
# Ensure `entry` is a dictionary with keys "start", "end", and "translated"
|
| 103 |
if isinstance(entry, dict) and "translated" in entry:
|