mjalpha commited on
Commit
8d80288
·
verified ·
1 Parent(s): 637d970

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import whisper
3
+
4
+ # Load Whisper model
5
+ model = whisper.load_model("base") # or "small" if CPU only
6
+
7
+ def transcribe_audio(audio):
8
+ result = model.transcribe(audio)
9
+ text = result['text']
10
+
11
+ # Simple Tagalog detection
12
+ tagalog_words = ["ang", "si", "ni", "ay", "sa", "ng"]
13
+ flagged = any(word in text.split() for word in tagalog_words)
14
+
15
+ return text, "⚠ Tagalog detected!" if flagged else "No Tagalog detected"
16
+
17
+ iface = gr.Interface(
18
+ fn=transcribe_audio,
19
+ inputs=gr.Audio(source="upload", type="filepath"),
20
+ outputs=[gr.Textbox(label="Transcript"), gr.Textbox(label="Flag")],
21
+ title="ClassWatch Audio Transcriber",
22
+ description="Upload classroom audio to get a transcript and detect if Tagalog is used."
23
+ )
24
+
25
+ iface.launch()