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)