File size: 1,069 Bytes
824a82b
 
 
 
 
 
b57f888
824a82b
 
 
 
e0c6e50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
824a82b
 
e0c6e50
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import gradio as gr
from main import main as process_video

def run_pipeline(youtube_url):
    # Run the main processing function from your script
    # This function should save the final video in the '/translated/' directory
    final_video_path = process_video(youtube_url)
    
    # Return the path for Gradio to display
    return final_video_path

with gr.Blocks() as demo:
    gr.Markdown(
        """
           Enter a YouTube URL to process the video through transcription, translation, and more.
        """,
        elem_id="header",
    )
    with gr.Column():
        user_prompt = gr.Textbox(
            placeholder="Enter YouTube Video URL here...",
            label="Input",
        )
        btn = gr.Button("Convert", label="Convert")

    with gr.Column():
        generated_video = gr.Video(
            interactive=False, label="Generated Video", include_audio=True
        )

    btn.click(
        fn=run_pipeline,
        inputs=user_prompt,
        outputs=generated_video
    )

if __name__ == "__main__":
    demo.launch(show_error=True)