Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -733,12 +733,12 @@ def upload_and_manage(file, target_language, process_mode):
|
|
733 |
translated_json = translate_text(transcription_json, source_language, target_language)
|
734 |
logger.info(f"Translation completed. Number of translated segments: {len(translated_json)}")
|
735 |
|
736 |
-
|
737 |
|
738 |
-
# Step 3: Add transcript to video based on timestamps
|
739 |
-
logger.info("Adding translated transcript to video...")
|
740 |
-
add_transcript_voiceover(file.name, translated_json, output_video_path, process_mode, target_language)
|
741 |
-
logger.info(f"Transcript added to video. Output video saved at {output_video_path}")
|
742 |
|
743 |
# Convert translated JSON into a format for the editable table
|
744 |
logger.info("Converting translated JSON into editable table format...")
|
@@ -752,7 +752,7 @@ def upload_and_manage(file, target_language, process_mode):
|
|
752 |
elapsed_time_display = f"Processing completed in {elapsed_time:.2f} seconds."
|
753 |
logger.info(f"Processing completed in {elapsed_time:.2f} seconds.")
|
754 |
|
755 |
-
return editable_table,
|
756 |
|
757 |
except Exception as e:
|
758 |
logger.error(f"An error occurred: {str(e)}")
|
@@ -783,8 +783,8 @@ def build_interface():
|
|
783 |
label="Edit Translations",
|
784 |
wrap=True # Enables text wrapping if supported
|
785 |
)
|
786 |
-
save_changes_button = gr.Button("Save Changes")
|
787 |
-
processed_video_output = gr.File(label="Download Processed Video", interactive=True) # Download button
|
788 |
elapsed_time_display = gr.Textbox(label="Elapsed Time", lines=1, interactive=False)
|
789 |
|
790 |
with gr.Column(scale=1):
|
@@ -805,11 +805,11 @@ def build_interface():
|
|
805 |
return message, gr.update(value=file_path, visible=True)
|
806 |
return message, gr.update(visible=False)
|
807 |
|
808 |
-
save_changes_button.click(
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
)
|
813 |
|
814 |
submit_button.click(
|
815 |
upload_and_manage,
|
|
|
733 |
translated_json = translate_text(transcription_json, source_language, target_language)
|
734 |
logger.info(f"Translation completed. Number of translated segments: {len(translated_json)}")
|
735 |
|
736 |
+
translated_json = post_edit_translated_segments(translated_json, file.name)
|
737 |
|
738 |
+
# # Step 3: Add transcript to video based on timestamps
|
739 |
+
# logger.info("Adding translated transcript to video...")
|
740 |
+
# add_transcript_voiceover(file.name, translated_json, output_video_path, process_mode, target_language)
|
741 |
+
# logger.info(f"Transcript added to video. Output video saved at {output_video_path}")
|
742 |
|
743 |
# Convert translated JSON into a format for the editable table
|
744 |
logger.info("Converting translated JSON into editable table format...")
|
|
|
752 |
elapsed_time_display = f"Processing completed in {elapsed_time:.2f} seconds."
|
753 |
logger.info(f"Processing completed in {elapsed_time:.2f} seconds.")
|
754 |
|
755 |
+
return editable_table, elapsed_time_display
|
756 |
|
757 |
except Exception as e:
|
758 |
logger.error(f"An error occurred: {str(e)}")
|
|
|
783 |
label="Edit Translations",
|
784 |
wrap=True # Enables text wrapping if supported
|
785 |
)
|
786 |
+
# save_changes_button = gr.Button("Save Changes")
|
787 |
+
# processed_video_output = gr.File(label="Download Processed Video", interactive=True) # Download button
|
788 |
elapsed_time_display = gr.Textbox(label="Elapsed Time", lines=1, interactive=False)
|
789 |
|
790 |
with gr.Column(scale=1):
|
|
|
805 |
return message, gr.update(value=file_path, visible=True)
|
806 |
return message, gr.update(visible=False)
|
807 |
|
808 |
+
# save_changes_button.click(
|
809 |
+
# update_translations,
|
810 |
+
# inputs=[file_input, editable_table, process_mode],
|
811 |
+
# outputs=[processed_video_output, elapsed_time_display]
|
812 |
+
# )
|
813 |
|
814 |
submit_button.click(
|
815 |
upload_and_manage,
|