AgentVikram commited on
Commit
0435fec
·
verified ·
1 Parent(s): de36103

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import whisper
3
+
4
+ # Choose model: "tiny" for faster, "base" for better accuracy
5
+ model = whisper.load_model("small")
6
+
7
+ def transcribe(audio):
8
+ if audio is None:
9
+ return "Please upload an audio file."
10
+ result = model.transcribe(audio)
11
+ return result["text"]
12
+
13
+ app = gr.Interface(
14
+ fn=transcribe,
15
+ inputs=gr.Audio(sources=["microphone", "upload"], type="filepath"),
16
+ outputs="textbox",
17
+ title="🎙️ Whisper Speech-to-Text",
18
+ description="Transcribe audio to text using OpenAI Whisper (Tiny model).",
19
+ )
20
+
21
+ app.launch()