File size: 774 Bytes
8d80288
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
import whisper

# Load Whisper model
model = whisper.load_model("base")  # or "small" if CPU only

def transcribe_audio(audio):
    result = model.transcribe(audio)
    text = result['text']

    # Simple Tagalog detection
    tagalog_words = ["ang", "si", "ni", "ay", "sa", "ng"]
    flagged = any(word in text.split() for word in tagalog_words)

    return text, "⚠ Tagalog detected!" if flagged else "No Tagalog detected"

iface = gr.Interface(
    fn=transcribe_audio,
    inputs=gr.Audio(source="upload", type="filepath"),
    outputs=[gr.Textbox(label="Transcript"), gr.Textbox(label="Flag")],
    title="ClassWatch Audio Transcriber",
    description="Upload classroom audio to get a transcript and detect if Tagalog is used."
)

iface.launch()