|
import gradio as gr |
|
import whisper |
|
|
|
|
|
model = whisper.load_model("base") |
|
|
|
def transcribe_audio(audio): |
|
|
|
result = model.transcribe(audio) |
|
text = result['text'] |
|
|
|
|
|
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() |
|
|