dtkne commited on
Commit
cf392a0
Β·
verified Β·
1 Parent(s): f430f55

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -36
app.py CHANGED
@@ -8,7 +8,6 @@ asr = pipeline(task="automatic-speech-recognition", model="distil-whisper/distil
8
  summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
9
  qa_pipeline = pipeline("question-answering", model="distilbert-base-cased-distilled-squad")
10
 
11
- # Global transcript
12
  stored_transcript = ""
13
 
14
  def transcribe_and_summarize(video_file):
@@ -44,47 +43,27 @@ def answer_question(question):
44
  result = qa_pipeline(question=question, context=stored_transcript)
45
  return result['answer']
46
 
47
- # Custom neon yellow and black theme
48
- neon_theme = gr.themes.Base(
49
- primary_hue="yellow",
50
- secondary_hue="yellow"
51
- ).set(
52
- body_background="#000000",
53
- body_text_color="#FFFF33", # Neon yellow
54
- button_primary_background="#FFFF33",
55
- button_primary_text_color="#000000",
56
- button_secondary_background="#222222",
57
- button_secondary_text_color="#FFFF33",
58
- input_background="#111111",
59
- input_border_color="#FFFF33",
60
- input_text_color="#FFFF33",
61
- block_border_color="#FFFF33",
62
- block_background="#000000"
63
- )
64
-
65
- # Gradio UI
66
- with gr.Blocks(theme=neon_theme) as iface:
67
- gr.Markdown("## πŸŽ₯ <span style='color:#FFFF33'>Video Transcriber, Summarizer & Q&A Tool</span>", unsafe_allow_html=True)
68
- gr.Markdown("<span style='color:#CCCC33'>Upload a video to get a transcript, summary, and ask questions about its content.</span>", unsafe_allow_html=True)
69
 
70
  with gr.Tab("πŸ“ Transcription & Summary"):
71
- with gr.Row():
72
- video_input = gr.Video(label="Upload Video (.mp4)", interactive=True)
73
- with gr.Row():
74
- transcribe_btn = gr.Button("πŸš€ Transcribe and Summarize")
75
- with gr.Row():
76
- transcribed_text = gr.Textbox(label="Transcribed Text", lines=8, interactive=False)
77
- summarized_text = gr.Textbox(label="Summarized Text", lines=8, interactive=False)
78
 
79
  transcribe_btn.click(fn=transcribe_and_summarize, inputs=video_input, outputs=[transcribed_text, summarized_text])
80
 
81
  with gr.Tab("❓ Ask Questions"):
82
- with gr.Row():
83
- question_input = gr.Textbox(label="Ask a question based on the transcript", placeholder="E.g., What is the main topic?")
84
- with gr.Row():
85
- ask_btn = gr.Button("πŸ” Get Answer")
86
- with gr.Row():
87
- answer_output = gr.Textbox(label="Answer", interactive=False)
88
 
89
  ask_btn.click(fn=answer_question, inputs=question_input, outputs=answer_output)
90
 
 
8
  summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
9
  qa_pipeline = pipeline("question-answering", model="distilbert-base-cased-distilled-squad")
10
 
 
11
  stored_transcript = ""
12
 
13
  def transcribe_and_summarize(video_file):
 
43
  result = qa_pipeline(question=question, context=stored_transcript)
44
  return result['answer']
45
 
46
+ with gr.Blocks(css="""
47
+ body { background-color: black !important; }
48
+ .gradio-container { color: #FFFF33 !important; }
49
+ button { background-color: #FFFF33 !important; color: black !important; border: none !important; }
50
+ input, textarea, .gr-textbox, .gr-video { background-color: #111 !important; color: #FFFF33 !important; border-color: #FFFF33 !important; }
51
+ """) as iface:
52
+ gr.HTML("<h1 style='color:#FFFF33'>πŸŽ₯ Video Transcriber, Summarizer & Q&A Tool</h1>")
53
+ gr.HTML("<p style='color:#CCCC33'>Upload a video to get a transcript, summary, and ask questions about its content.</p>")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
  with gr.Tab("πŸ“ Transcription & Summary"):
56
+ video_input = gr.Video(label="Upload Video (.mp4)", interactive=True)
57
+ transcribe_btn = gr.Button("πŸš€ Transcribe and Summarize")
58
+ transcribed_text = gr.Textbox(label="Transcribed Text", lines=8, interactive=False)
59
+ summarized_text = gr.Textbox(label="Summarized Text", lines=8, interactive=False)
 
 
 
60
 
61
  transcribe_btn.click(fn=transcribe_and_summarize, inputs=video_input, outputs=[transcribed_text, summarized_text])
62
 
63
  with gr.Tab("❓ Ask Questions"):
64
+ question_input = gr.Textbox(label="Ask a question based on the transcript", placeholder="E.g., What is the main topic?")
65
+ ask_btn = gr.Button("πŸ” Get Answer")
66
+ answer_output = gr.Textbox(label="Answer", interactive=False)
 
 
 
67
 
68
  ask_btn.click(fn=answer_question, inputs=question_input, outputs=answer_output)
69