thomasanto7001 commited on
Commit
2a528c9
Β·
verified Β·
1 Parent(s): 459042c

Upload interface.py

Browse files
Files changed (1) hide show
  1. interface.py +49 -0
interface.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import gradio as gr
3
+ from app import download_youtube_video, process_video
4
+
5
+ def smartscribe_interface(video_file, youtube_link, services):
6
+ if not video_file and not youtube_link:
7
+ return "❌ Please upload a video or paste a YouTube link.", None, None, None, None
8
+
9
+ input_path = "input_video.mp4"
10
+ if youtube_link:
11
+ download_youtube_video(youtube_link, filename=input_path)
12
+ else:
13
+ video_file.save(input_path)
14
+
15
+ results = process_video(input_path, services)
16
+
17
+ return (
18
+ results.get("transcription", "N/A"),
19
+ results.get("summary", "N/A"),
20
+ results.get("subtitles", "N/A"),
21
+ results.get("quiz", "N/A"),
22
+ )
23
+
24
+ with gr.Blocks() as demo:
25
+ gr.Markdown("# πŸŽ“ SmartScribe - AI-Powered Learning Assistant")
26
+
27
+ with gr.Row():
28
+ video_input = gr.Video(label="πŸ“€ Upload a Video File (MP4)")
29
+ youtube_input = gr.Textbox(label="πŸ“Ž Or Paste a YouTube Link")
30
+
31
+ services = gr.CheckboxGroup(
32
+ ["Transcription", "Summary", "Subtitles", "Quiz"],
33
+ label="πŸ› οΈ Select Services"
34
+ )
35
+
36
+ submit_btn = gr.Button("πŸš€ Process Video")
37
+
38
+ transcription_output = gr.Textbox(label="πŸ“„ Transcription")
39
+ summary_output = gr.Textbox(label="πŸ“ Summary")
40
+ subtitle_output = gr.Textbox(label="🎬 Subtitles (SRT or Text)")
41
+ quiz_output = gr.Textbox(label="❓ Auto-Generated Quiz")
42
+
43
+ submit_btn.click(
44
+ smartscribe_interface,
45
+ inputs=[video_input, youtube_input, services],
46
+ outputs=[transcription_output, summary_output, subtitle_output, quiz_output]
47
+ )
48
+
49
+ demo.launch()