Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import whisper
|
3 |
+
|
4 |
+
# Load Whisper model
|
5 |
+
model = whisper.load_model("base")
|
6 |
+
|
7 |
+
def transcribe(audio_path):
|
8 |
+
"""Transcribes the given audio file using OpenAI's Whisper model."""
|
9 |
+
if audio_path is None:
|
10 |
+
return "No audio file provided."
|
11 |
+
|
12 |
+
# Load and transcribe the audio
|
13 |
+
result = model.transcribe(audio_path)
|
14 |
+
return result["text"]
|
15 |
+
|
16 |
+
# Create Gradio interface
|
17 |
+
app = gr.Interface(fn=transcribe, inputs=gr.Audio(type="filepath"), outputs="text")
|
18 |
+
app.launch()
|