Update app.py
Browse files
app.py
CHANGED
|
@@ -53,46 +53,15 @@ def transcribe(file, task, return_timestamps):
|
|
| 53 |
demo = gr.Blocks()
|
| 54 |
|
| 55 |
mic_transcribe = gr.Interface(
|
| 56 |
-
fn=
|
| 57 |
-
inputs=
|
| 58 |
-
|
| 59 |
-
gr.inputs.Radio(["transcribe", "translate"], label="Task", default="transcribe"),
|
| 60 |
-
gr.inputs.Checkbox(default=False, label="Return timestamps"),
|
| 61 |
-
],
|
| 62 |
-
outputs="text",
|
| 63 |
-
layout="horizontal",
|
| 64 |
-
theme="huggingface",
|
| 65 |
-
title="Whisper Demo: Transcribe Audio",
|
| 66 |
-
description=(
|
| 67 |
-
"Transcribe long-form microphone or audio inputs with the click of a button! Demo uses the"
|
| 68 |
-
f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
|
| 69 |
-
" of arbitrary length."
|
| 70 |
-
),
|
| 71 |
-
allow_flagging="never",
|
| 72 |
)
|
| 73 |
|
| 74 |
file_transcribe = gr.Interface(
|
| 75 |
-
fn=
|
| 76 |
-
inputs=
|
| 77 |
-
|
| 78 |
-
gr.inputs.Radio(["transcribe", "translate"], label="Task", default="transcribe"),
|
| 79 |
-
gr.inputs.Checkbox(default=False, label="Return timestamps"),
|
| 80 |
-
],
|
| 81 |
-
outputs="text",
|
| 82 |
-
layout="horizontal",
|
| 83 |
-
theme="huggingface",
|
| 84 |
-
title="Whisper Demo: Transcribe Audio",
|
| 85 |
-
description=(
|
| 86 |
-
"Transcribe long-form microphone or audio inputs with the click of a button! Demo uses the"
|
| 87 |
-
f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
|
| 88 |
-
" of arbitrary length."
|
| 89 |
-
),
|
| 90 |
-
examples=[
|
| 91 |
-
["./example.flac", "transcribe", False],
|
| 92 |
-
["./example.flac", "transcribe", True],
|
| 93 |
-
],
|
| 94 |
-
cache_examples=True,
|
| 95 |
-
allow_flagging="never",
|
| 96 |
)
|
| 97 |
|
| 98 |
with demo:
|
|
|
|
| 53 |
demo = gr.Blocks()
|
| 54 |
|
| 55 |
mic_transcribe = gr.Interface(
|
| 56 |
+
fn=transcribe_speech,
|
| 57 |
+
inputs=gr.Audio(sources="microphone", type="filepath"),
|
| 58 |
+
outputs=gr.components.Textbox(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
)
|
| 60 |
|
| 61 |
file_transcribe = gr.Interface(
|
| 62 |
+
fn=transcribe_speech,
|
| 63 |
+
inputs=gr.Audio(sources="upload", type="filepath"),
|
| 64 |
+
outputs=gr.components.Textbox(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
)
|
| 66 |
|
| 67 |
with demo:
|