import gradio as gr import utils import transcribe with gr.Blocks(theme="base") as demo: gr.Markdown("

🔊 Transcription Delight

") with gr.Tabs(selected="result") as tabs: with gr.Tab("Input"): with gr.Row(): with gr.Column(): source = gr.Radio(label="Source type", choices=[("Audio", "audio"), ("Video", "video"), ("YouTube URL", "youtube")], value="audio") @gr.render(inputs=source) def show_source(s): if s == "audio": source_component = gr.Audio(type="filepath") elif s == "video": source_component = gr.Video() else: source_component = gr.Textbox(placeholder="https://www.youtube.com/watch?v=44vi31hehw4") preview = gr.HTML(label="Video preview") source_component.change(utils.convert_to_embed_url, source_component, preview) transcribe_btn.click( lambda : gr.Tabs(selected="result"), None, tabs ).then( utils.generate_audio, [source, source_component], [download_audio], show_progress="minimal" ).then( transcribe.transcribe, [download_audio], [preliminary_transcript], show_progress="hidden" ) with gr.Column(): gr.Dropdown(label="Languages", choices=["(Autodetect)", "English"], value="(Autodetect)") gr.CheckboxGroup(label="Cleanup Transcript with LLM", choices=["Remove typos", "Separate into paragraphs"]) gr.Checkbox(label="Diarize Speakers (coming soon)", interactive=False) transcribe_btn = gr.Button("Transcribe audio ✨", variant="primary") source.change(utils.transcribe_button, source, transcribe_btn) with gr.Tab("Result", id="result"): with gr.Row(): with gr.Column(): download_audio = gr.DownloadButton("Downloading Audio File (please wait...)", variant="primary", interactive=False, size="sm") preliminary_transcript = gr.Textbox(info="Preliminary transcript", lines=10, show_copy_button=True, show_label=False, interactive=False) with gr.Column(): gr.Markdown("*Final transcript will appear here*") demo.launch()