Spaces:
Running on Zero
Running on Zero
Commit ·
6d7aafe
1
Parent(s): f8ae045
Try OpenAI Whisper
Browse files- .python-version +1 -0
- README.md +1 -0
- app.py +4 -11
- apt.txt +0 -2
- requirements.txt +2 -4
.python-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
3.9.9
|
README.md
CHANGED
|
@@ -6,6 +6,7 @@ colorTo: indigo
|
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.30.0
|
| 8 |
app_file: app.py
|
|
|
|
| 9 |
pinned: false
|
| 10 |
license: unlicense
|
| 11 |
short_description: Minimum working OpenAI Whisper pipeline in just 19 lines.
|
|
|
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.30.0
|
| 8 |
app_file: app.py
|
| 9 |
+
python_version: 3.9.9
|
| 10 |
pinned: false
|
| 11 |
license: unlicense
|
| 12 |
short_description: Minimum working OpenAI Whisper pipeline in just 19 lines.
|
app.py
CHANGED
|
@@ -1,21 +1,14 @@
|
|
| 1 |
"""Minimum code to run whisper-faster on Hugging Face"""
|
| 2 |
-
|
| 3 |
import gradio as gr
|
| 4 |
import spaces
|
| 5 |
-
from faster_whisper import WhisperModel
|
| 6 |
-
|
| 7 |
-
@lru_cache(maxsize=1)
|
| 8 |
-
def get_model():
|
| 9 |
-
"""Model caching function"""
|
| 10 |
-
return WhisperModel("large-v3", device="cuda", compute_type="float16")
|
| 11 |
-
|
| 12 |
|
| 13 |
@spaces.GPU(duration=120)
|
| 14 |
def transcribe(gradio_input_one_return_audio_filepath: str):
|
| 15 |
"""Makes a call to transcribe the audio"""
|
| 16 |
-
model =
|
| 17 |
-
|
| 18 |
-
return
|
| 19 |
|
| 20 |
interface = gr.Interface(
|
| 21 |
fn = transcribe,
|
|
|
|
| 1 |
"""Minimum code to run whisper-faster on Hugging Face"""
|
| 2 |
+
import whisper
|
| 3 |
import gradio as gr
|
| 4 |
import spaces
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
@spaces.GPU(duration=120)
|
| 7 |
def transcribe(gradio_input_one_return_audio_filepath: str):
|
| 8 |
"""Makes a call to transcribe the audio"""
|
| 9 |
+
model = whisper.load_model("base").to("cuda")
|
| 10 |
+
res = model.transcribe(gradio_input_one_return_audio_filepath)
|
| 11 |
+
return res["text"]
|
| 12 |
|
| 13 |
interface = gr.Interface(
|
| 14 |
fn = transcribe,
|
apt.txt
CHANGED
|
@@ -1,3 +1 @@
|
|
| 1 |
ffmpeg
|
| 2 |
-
libsndfile1
|
| 3 |
-
|
|
|
|
| 1 |
ffmpeg
|
|
|
|
|
|
requirements.txt
CHANGED
|
@@ -1,5 +1,3 @@
|
|
| 1 |
-
gradio
|
| 2 |
-
faster-whisper
|
| 3 |
-
ctranslate2
|
| 4 |
-
ffmpeg-python
|
| 5 |
spaces
|
|
|
|
|
|
| 1 |
+
gradio
|
|
|
|
|
|
|
|
|
|
| 2 |
spaces
|
| 3 |
+
openai-whisper
|