Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import moviepy.editor as mp
|
3 |
import librosa
|
4 |
-
import numpy as np
|
5 |
from transformers import pipeline
|
6 |
|
7 |
# Load Whisper model for speech-to-text
|
@@ -69,7 +68,8 @@ def generate_subtitles(video_file, language_name):
|
|
69 |
translation_pipeline = pipeline('translation', model='facebook/m2m100_418M')
|
70 |
translated_subtitles = translation_pipeline(
|
71 |
full_transcription,
|
72 |
-
|
|
|
73 |
)[0]["translation_text"]
|
74 |
|
75 |
# Return subtitles
|
|
|
1 |
import gradio as gr
|
2 |
import moviepy.editor as mp
|
3 |
import librosa
|
|
|
4 |
from transformers import pipeline
|
5 |
|
6 |
# Load Whisper model for speech-to-text
|
|
|
68 |
translation_pipeline = pipeline('translation', model='facebook/m2m100_418M')
|
69 |
translated_subtitles = translation_pipeline(
|
70 |
full_transcription,
|
71 |
+
src_lang="en", # Source language is English
|
72 |
+
tgt_lang=target_language # Target language from user selection
|
73 |
)[0]["translation_text"]
|
74 |
|
75 |
# Return subtitles
|