SmartScribe / interface.py
thomasanto7001's picture
Upload interface.py
2a528c9 verified
raw
history blame
1.6 kB
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()