Spaces:
Running
Running
File size: 1,595 Bytes
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 |
import gradio as gr
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:
video_file.save(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()
|