Spaces:
Sleeping
Sleeping
File size: 1,649 Bytes
ae09409 |
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 38 39 40 41 42 43 44 45 46 47 48 49 50 |
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() |