Spaces:
Sleeping
Sleeping
from Summarizer_Agent import Summarizer | |
import gradio as gr | |
summarizer=Summarizer() | |
flags = { | |
"us": "๐บ๐ธ", | |
"england": "๐ด", | |
"australia": "๐ฆ๐บ", | |
"indian": "๐ฎ๐ณ", | |
"canada": "๐จ๐ฆ", | |
"bermuda": "๐ง๐ฒ", | |
"scotland": "๐ด", | |
"african": "๐", | |
"ireland": "๐ฎ๐ช", | |
"newzealand": "๐ณ๐ฟ", | |
"wales": "๐ด", | |
"malaysia": "๐ฒ๐พ", | |
"philippines": "๐ต๐ญ", | |
"singapore": "๐ธ๐ฌ", | |
"hongkong": "๐ญ๐ฐ", | |
"southatlandtic": "๐" | |
} | |
def process_youtube(url): | |
try: | |
summary = summarizer.summarize(url) | |
accent_info = summarizer.classify(url) | |
accent = accent_info["label"] | |
flag = flags.get(accent.lower(), "๐ณ๏ธ") # fallback to white flag if not found | |
accent_display = f"{flag} {accent.capitalize()}" | |
return summary, accent_display, accent_info["score"] | |
except Exception as e: | |
return f"Error: {e}" | |
demo = gr.Interface( | |
fn=process_youtube, | |
inputs=gr.Textbox(label="public video URL", placeholder="Enter public video link here..."), | |
outputs=[ | |
gr.Textbox(label="Candidate Summary", lines=10), | |
gr.Textbox(label="Detected Accent"), | |
gr.Slider(label="Confidence Score (%)", minimum=0, maximum=1, step=0.001, interactive=False) | |
], | |
title="Interview Audio Summarizer", | |
description="Paste an interview video link. The app will summarize the candidate's response and detect the speaker's accent." | |
) | |
if __name__=="__main__": | |
demo.launch() |