File size: 1,617 Bytes
2a528c9
 
7c12e62
2a528c9
 
 
 
 
 
 
 
 
 
7c12e62
2a528c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
41
42
43
44
45
46
47
48
49
50
51

import gradio as gr
import shutil
from app import download_youtube_video, process_video

def smartscribe_interface(video_file, youtube_link, services):
    if not video_file and not youtube_link:
        return "❌ Please upload a video or paste a YouTube link.", None, None, None, None

    input_path = "input_video.mp4"
    if youtube_link:
        download_youtube_video(youtube_link, filename=input_path)
    else:
        shutil.copy(video_file, input_path)

    results = process_video(input_path, services)

    return (
        results.get("transcription", "N/A"),
        results.get("summary", "N/A"),
        results.get("subtitles", "N/A"),
        results.get("quiz", "N/A"),
    )

with gr.Blocks() as demo:
    gr.Markdown("# πŸŽ“ SmartScribe - AI-Powered Learning Assistant")

    with gr.Row():
        video_input = gr.Video(label="πŸ“€ Upload a Video File (MP4)")
        youtube_input = gr.Textbox(label="πŸ“Ž Or Paste a YouTube Link")

    services = gr.CheckboxGroup(
        ["Transcription", "Summary", "Subtitles", "Quiz"],
        label="πŸ› οΈ Select Services"
    )

    submit_btn = gr.Button("πŸš€ Process Video")

    transcription_output = gr.Textbox(label="πŸ“„ Transcription")
    summary_output = gr.Textbox(label="πŸ“ Summary")
    subtitle_output = gr.Textbox(label="🎬 Subtitles (SRT or Text)")
    quiz_output = gr.Textbox(label="❓ Auto-Generated Quiz")

    submit_btn.click(
        smartscribe_interface,
        inputs=[video_input, youtube_input, services],
        outputs=[transcription_output, summary_output, subtitle_output, quiz_output]
    )

demo.launch()