Spaces:
Sleeping
Sleeping
File size: 1,367 Bytes
cd3b063 cd097b0 cd3b063 3f160eb cd3b063 3f160eb cd3b063 5a7bd84 cd3b063 fcecf5e eed98a1 5a7bd84 |
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 |
import gradio as gr
def process_keywords_and_video(url, excel_file):
metadata, error = fetch_video_metadata(url)
if error:
return error, None
transcript, error = fetch_transcript(url)
if error:
return error, None
sentences = split_long_sentences(transcript)
keywords, attributes = read_keywords(excel_file)
matched_keywords = match_keywords_in_sentences(sentences, keywords)
sentiment_results = analyze_sentiment_for_keywords(matched_keywords, sentences)
wordclouds = generate_word_clouds(matched_keywords)
pdf_file = generate_pdf_with_sections(metadata, sentiment_results, wordclouds)
return "Processing completed successfully!", pdf_file
# Gradio App
with gr.Blocks() as iface:
gr.Markdown("<h1>Auto-Insight: YouTube Video Analyzer for Automobiles</h1>")
video_url = gr.Textbox(label="YouTube Video URL", placeholder="Enter the YouTube video URL")
excel_file = gr.File(label="Upload Excel File with Keywords")
process_button = gr.Button("Analyze Video")
processing_status = gr.Textbox(label="Processing Status", interactive=False)
pdf_output = gr.File(label="Download Sentiment Report (PDF)")
process_button.click(
process_keywords_and_video,
inputs=[video_url, excel_file],
outputs=[processing_status, pdf_output]
)
iface.launch(share=True)
|