Add prints to get easy debug into huggingface logs
Browse files
app.py
CHANGED
|
@@ -460,6 +460,9 @@ def change_visibility_texboxes():
|
|
| 460 |
)
|
| 461 |
|
| 462 |
def get_audio_and_video_from_video(url):
|
|
|
|
|
|
|
|
|
|
| 463 |
audios_folder = "audios"
|
| 464 |
videos_folder = "videos"
|
| 465 |
if not os.path.exists(audios_folder):
|
|
@@ -482,6 +485,9 @@ def get_audio_and_video_from_video(url):
|
|
| 482 |
)
|
| 483 |
|
| 484 |
def slice_audio(audio_path):
|
|
|
|
|
|
|
|
|
|
| 485 |
folder_vocals = "vocals"
|
| 486 |
folder_chunck = "chunks"
|
| 487 |
if not os.path.exists(folder_vocals):
|
|
@@ -498,6 +504,9 @@ def slice_audio(audio_path):
|
|
| 498 |
)
|
| 499 |
|
| 500 |
def trascribe_audio(source_languaje, number_of_speakers):
|
|
|
|
|
|
|
|
|
|
| 501 |
folder_chunks = "chunks"
|
| 502 |
python_file = "transcribe.py"
|
| 503 |
chunks_file = "chunks/output_files.txt"
|
|
@@ -519,6 +528,9 @@ def trascribe_audio(source_languaje, number_of_speakers):
|
|
| 519 |
)
|
| 520 |
|
| 521 |
def concatenate_transcriptions():
|
|
|
|
|
|
|
|
|
|
| 522 |
folder_concatenated = "concatenated_transcriptions"
|
| 523 |
if not os.path.exists(folder_concatenated):
|
| 524 |
os.makedirs(folder_concatenated)
|
|
@@ -546,6 +558,9 @@ def concatenate_transcriptions():
|
|
| 546 |
)
|
| 547 |
|
| 548 |
def translate_transcription(original_audio_transcribed_path, source_languaje, target_languaje):
|
|
|
|
|
|
|
|
|
|
| 549 |
folder_translated_transcriptions = "translated_transcriptions"
|
| 550 |
if not os.path.exists(folder_translated_transcriptions):
|
| 551 |
os.makedirs(folder_translated_transcriptions)
|
|
@@ -567,6 +582,9 @@ def translate_transcription(original_audio_transcribed_path, source_languaje, ta
|
|
| 567 |
)
|
| 568 |
|
| 569 |
def add_translated_subtitles_to_video(original_video_path, original_audio_path, original_audio_translated_path):
|
|
|
|
|
|
|
|
|
|
| 570 |
python_file = "add_subtitles_to_video.py"
|
| 571 |
command = f"python {python_file} {original_audio_translated_path} {original_video_path} {original_audio_path}"
|
| 572 |
os.system(command)
|
|
|
|
| 460 |
)
|
| 461 |
|
| 462 |
def get_audio_and_video_from_video(url):
|
| 463 |
+
print('*'*NUMBER)
|
| 464 |
+
print(f"Downloading video and audio from {url}")
|
| 465 |
+
|
| 466 |
audios_folder = "audios"
|
| 467 |
videos_folder = "videos"
|
| 468 |
if not os.path.exists(audios_folder):
|
|
|
|
| 485 |
)
|
| 486 |
|
| 487 |
def slice_audio(audio_path):
|
| 488 |
+
print('*'*NUMBER)
|
| 489 |
+
print("Slicing audio")
|
| 490 |
+
|
| 491 |
folder_vocals = "vocals"
|
| 492 |
folder_chunck = "chunks"
|
| 493 |
if not os.path.exists(folder_vocals):
|
|
|
|
| 504 |
)
|
| 505 |
|
| 506 |
def trascribe_audio(source_languaje, number_of_speakers):
|
| 507 |
+
print('*'*NUMBER)
|
| 508 |
+
print("Transcript slices")
|
| 509 |
+
|
| 510 |
folder_chunks = "chunks"
|
| 511 |
python_file = "transcribe.py"
|
| 512 |
chunks_file = "chunks/output_files.txt"
|
|
|
|
| 528 |
)
|
| 529 |
|
| 530 |
def concatenate_transcriptions():
|
| 531 |
+
print('*'*NUMBER)
|
| 532 |
+
print("Concatenate transcriptions")
|
| 533 |
+
|
| 534 |
folder_concatenated = "concatenated_transcriptions"
|
| 535 |
if not os.path.exists(folder_concatenated):
|
| 536 |
os.makedirs(folder_concatenated)
|
|
|
|
| 558 |
)
|
| 559 |
|
| 560 |
def translate_transcription(original_audio_transcribed_path, source_languaje, target_languaje):
|
| 561 |
+
print('*'*NUMBER)
|
| 562 |
+
print("Translate transcription")
|
| 563 |
+
|
| 564 |
folder_translated_transcriptions = "translated_transcriptions"
|
| 565 |
if not os.path.exists(folder_translated_transcriptions):
|
| 566 |
os.makedirs(folder_translated_transcriptions)
|
|
|
|
| 582 |
)
|
| 583 |
|
| 584 |
def add_translated_subtitles_to_video(original_video_path, original_audio_path, original_audio_translated_path):
|
| 585 |
+
print('*'*NUMBER)
|
| 586 |
+
print("Add subtitles to video")
|
| 587 |
+
|
| 588 |
python_file = "add_subtitles_to_video.py"
|
| 589 |
command = f"python {python_file} {original_audio_translated_path} {original_video_path} {original_audio_path}"
|
| 590 |
os.system(command)
|