Update app.py
Browse files
app.py
CHANGED
|
@@ -14,6 +14,12 @@ from moviepy import (
|
|
| 14 |
import speech_recognition as sr
|
| 15 |
import json
|
| 16 |
from nltk.tokenize import sent_tokenize
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
def transcribe_video(video_path):
|
| 19 |
# Load the video file and extract audio
|
|
@@ -63,6 +69,7 @@ def get_translation_model(target_language):
|
|
| 63 |
def translate_text(timestamps_json, target_language):
|
| 64 |
# Load the translation model for the specified target language
|
| 65 |
translation_model_id = get_translation_model(target_language)
|
|
|
|
| 66 |
translator = pipeline("translation", model=translation_model_id)
|
| 67 |
|
| 68 |
# Parse the input JSON
|
|
|
|
| 14 |
import speech_recognition as sr
|
| 15 |
import json
|
| 16 |
from nltk.tokenize import sent_tokenize
|
| 17 |
+
import logging
|
| 18 |
+
|
| 19 |
+
# Configure logging
|
| 20 |
+
logging.basicConfig(level=logging.DEBUG, format="%(asctime)s - %(levelname)s - %(message)s")
|
| 21 |
+
logger = logging.getLogger(__name__)
|
| 22 |
+
|
| 23 |
|
| 24 |
def transcribe_video(video_path):
|
| 25 |
# Load the video file and extract audio
|
|
|
|
| 69 |
def translate_text(timestamps_json, target_language):
|
| 70 |
# Load the translation model for the specified target language
|
| 71 |
translation_model_id = get_translation_model(target_language)
|
| 72 |
+
logger.debug(f"Translation model: {translation_model_id}")
|
| 73 |
translator = pipeline("translation", model=translation_model_id)
|
| 74 |
|
| 75 |
# Parse the input JSON
|