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()