Spaces:
Runtime error
Runtime error
| 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() | |