Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import whisper
|
3 |
+
|
4 |
+
model = whisper.load_model("medium")
|
5 |
+
|
6 |
+
def transcribe_audio(file):
|
7 |
+
return model.transcribe(file)['text']
|
8 |
+
|
9 |
+
|
10 |
+
def main():
|
11 |
+
audio_input = gr.inputs.Audio(source="microphone", type="filepath")
|
12 |
+
output = gr.outputs.Textbox()
|
13 |
+
|
14 |
+
iface = gr.Interface(fn=transcribe_audio, inputs=audio_input, outputs=output,
|
15 |
+
title="ASR Whisper")
|
16 |
+
iface.queue().launch(share=True, debug=True, inline=False)
|
17 |
+
|
18 |
+
if __name__ == '__main__':
|
19 |
+
main()
|