File size: 809 Bytes
93a8660
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from translate import Translate  # Import the Translate class
import gradio as gr

def translate_video(video_path, original_language, target_language, speaking_rate):
    translator = Translate(video_path, target_language, original_language, speaking_rate)
    translator.transcribe_and_translate()
    return "translated_video.mp4"

interface = gr.Interface(fn=translate_video,
    inputs=[
        gr.File(type="video", label="Select Video"),
        gr.Textbox("English", label="Original Language"),
        gr.Textbox("Spanish", label="Target Language"),
        gr.Slider(minimum=0.5, maximum=2.0, default=1.0, label="Speaking Rate")
    ],
    outputs=gr.Video(type="mp4", label="Translated Video"),
    live=True,
    interpretation="default",
    capture_session=True
)

interface.launch(debug = True)