Spaces:
Runtime error
Runtime error
storresbusquets
commited on
Commit
·
ee0d33f
1
Parent(s):
92404c9
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import whisper
|
3 |
+
|
4 |
+
|
5 |
+
def transcribe_audio(audio_file):
|
6 |
+
model = whisper.load_model("base")
|
7 |
+
result = model.transcribe(audio_file)
|
8 |
+
return result["text"]
|
9 |
+
|
10 |
+
|
11 |
+
def main():
|
12 |
+
audio_input = gr.Audio(source="upload", type="filepath")
|
13 |
+
output_text = gr.Textbox()
|
14 |
+
|
15 |
+
iface = gr.Interface(fn=transcribe_audio, inputs=audio_input,
|
16 |
+
outputs=output_text, title="Audio Transcription App",
|
17 |
+
description="Upload an audio file and hit the 'Submit'\
|
18 |
+
button")
|
19 |
+
|
20 |
+
iface.launch()
|
21 |
+
|
22 |
+
|
23 |
+
if __name__ == '__main__':
|
24 |
+
main()
|