Spaces:
Build error
Build error
Commit ·
818df4c
1
Parent(s): d2f4273
Simplify everything even more
Browse files
README.md
CHANGED
|
@@ -8,7 +8,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
|
| 12 |
---
|
| 13 |
|
| 14 |
# Minimum OpenAI _[faster]_ Whisper
|
|
|
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: unlicense
|
| 11 |
+
short_description: Minimum working OpenAI Whisper pipeline in just 19 lines.
|
| 12 |
---
|
| 13 |
|
| 14 |
# Minimum OpenAI _[faster]_ Whisper
|
app.py
CHANGED
|
@@ -4,27 +4,15 @@ from faster_whisper import WhisperModel
|
|
| 4 |
|
| 5 |
model = WhisperModel("large-v3", device="cuda", compute_type="float16")
|
| 6 |
|
| 7 |
-
def transcribe(gradio_input_one_return_audio_filepath: str
|
| 8 |
-
lang_code: str
|
| 9 |
-
):
|
| 10 |
"""Makes a call to transcribe the audio"""
|
| 11 |
-
segments, _ = model.transcribe(
|
| 12 |
-
gradio_input_one_return_audio_filepath,
|
| 13 |
-
language=lang_code
|
| 14 |
-
)
|
| 15 |
return "\n".join([seg.text for seg in segments])
|
| 16 |
|
| 17 |
interface = gr.Interface(
|
| 18 |
fn = transcribe,
|
| 19 |
-
inputs =
|
| 20 |
-
|
| 21 |
-
gr.Dropdown(
|
| 22 |
-
label="Language",
|
| 23 |
-
choices=["en", "fr", "es"],
|
| 24 |
-
value="Detect language",
|
| 25 |
-
),
|
| 26 |
-
],
|
| 27 |
-
outputs = gr.Markdown(label="Transcription Output"),
|
| 28 |
title = "Minimum Whisper Transcription"
|
| 29 |
)
|
| 30 |
|
|
|
|
| 4 |
|
| 5 |
model = WhisperModel("large-v3", device="cuda", compute_type="float16")
|
| 6 |
|
| 7 |
+
def transcribe(gradio_input_one_return_audio_filepath: str):
|
|
|
|
|
|
|
| 8 |
"""Makes a call to transcribe the audio"""
|
| 9 |
+
segments, _ = model.transcribe(gradio_input_one_return_audio_filepath)
|
|
|
|
|
|
|
|
|
|
| 10 |
return "\n".join([seg.text for seg in segments])
|
| 11 |
|
| 12 |
interface = gr.Interface(
|
| 13 |
fn = transcribe,
|
| 14 |
+
inputs = gr.Audio(type="filepath", label="Upload audio"),
|
| 15 |
+
outputs = gr.Textbox(label="Transcription Output"),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
title = "Minimum Whisper Transcription"
|
| 17 |
)
|
| 18 |
|