AccentDetector / app.py
DjallelBr's picture
Upload folder using huggingface_hub
ae09409 verified
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()