Spaces:
Runtime error
Runtime error
David Li
commited on
Commit
•
486fa96
1
Parent(s):
a9d31b3
fix: update whisper
Browse files- app.py +22 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import whisper
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
|
5 |
+
def get_text_from_mp3_whisper(mp3_file: str)->str:
|
6 |
+
model = whisper.load_model("base")
|
7 |
+
# options = whisper.DecodingOptions(language="en", without_timestamps=True)
|
8 |
+
result = model.transcribe(mp3_file)
|
9 |
+
return result.text
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
gr.Interface(
|
14 |
+
title = 'OpenAI Whisper ASR Gradio Web UI',
|
15 |
+
fn=get_text_from_mp3_whisper,
|
16 |
+
inputs=[
|
17 |
+
gr.inputs.Audio(type="filepath")
|
18 |
+
],
|
19 |
+
outputs=[
|
20 |
+
"textbox"
|
21 |
+
],
|
22 |
+
live=True).launch()
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
gradio
|
2 |
+
git+https://github.com/openai/whisper.git
|