Spaces:
Runtime error
Runtime error
File size: 2,178 Bytes
6c226f9 f6b3810 6c226f9 f6b3810 6c226f9 3ce82e9 3c0cd8e 1fbf59c 3c0cd8e f6b3810 3c0cd8e 3ce82e9 6c226f9 a5bfe25 6c226f9 b95b5ca 6c226f9 f6b3810 7097513 3ce82e9 7097513 6c226f9 a5bfe25 6c226f9 b95b5ca 6c226f9 f6b3810 7097513 f6b3810 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
import gradio as gr
import spaces
from utils import MODEL_NAME
from transcribe import transcribe
from youtube import yt_transcribe
demo = gr.Blocks()
mf_transcribe = gr.Interface(
fn=spaces.GPU(transcribe),
inputs=[
gr.Audio(sources="microphone", type="filepath"),
gr.Radio(["transcribe", "translate"], label="Task", value="transcribe"),
],
outputs="text",
title="Whisper Large V3: Transcribe Audio",
description=(
"Transcribe long-form microphone or audio inputs with the click of a button! Demo uses the"
f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
" of arbitrary length."
),
allow_flagging="never",
)
file_transcribe = gr.Interface(
fn=spaces.GPU(transcribe),
inputs=[
gr.Audio(sources="upload", type="filepath", label="Audio file"),
gr.Radio(["transcribe", "translate"], label="Task", value="transcribe"),
],
outputs="text",
title="Whisper Large V3: Transcribe Audio",
description=(
"Transcribe long-form microphone or audio inputs with the click of a button! Demo uses the"
f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe audio files"
" of arbitrary length."
),
allow_flagging="never",
)
yt_transcribe_interface = gr.Interface(
fn=spaces.GPU(yt_transcribe),
inputs=[
gr.Textbox(lines=1, placeholder="Paste the URL to a YouTube video here", label="YouTube URL"),
gr.Radio(["transcribe", "translate"], label="Task", value="transcribe")
],
outputs=["html", "text"],
title="Whisper Large V3: Transcribe YouTube",
description=(
"Transcribe long-form YouTube videos with the click of a button! Demo uses the checkpoint"
f" [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to transcribe video files of"
" arbitrary length."
),
allow_flagging="never",
)
with demo:
gr.TabbedInterface([mf_transcribe, file_transcribe, yt_transcribe_interface], ["Microphone", "Audio file", "YouTube"])
demo.queue().launch() |