File size: 1,010 Bytes
824a82b
 
 
a96698f
824a82b
a96698f
 
b57f888
824a82b
 
 
a96698f
e0c6e50
 
 
a96698f
 
e0c6e50
 
 
 
 
 
 
8ea135a
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
40
import gradio as gr
from main import main as process_video

 # Runs main processing function
def run_pipeline(youtube_url):
   
    # Save final video path
    final_video_path = process_video(youtube_url)
    
    return final_video_path

# Gradio UI
with gr.Blocks() as demo:
    gr.Markdown(
        """
           # Convert YouTube video to speech and writen subtitles in Spanish.
           ## Note: This code is optimized for GPU. Online use is slow due to CPU. Recommended local usage.
        """,
        elem_id="header",
    )
    with gr.Column():
        user_prompt = gr.Textbox(
            placeholder="Enter YouTube Video URL here...",
        )
        btn = gr.Button("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)