import os def fetch_transcript(url, name): transcript_filename = f"{name}.txt" os.system(f"youtube-dl --write-auto-sub --skip-download --sub-format txt {url} -o {transcript_filename}") if os.path.exists(transcript_filename): return transcript_filename else: raise FileNotFoundError(f"Transcript file '{transcript_filename}' could not be found.") import gradio as gr gr.Interface( fetch_transcript, [gr.Textbox(label="YouTube Video URL", placeholder="URL goes here..."), gr.Textbox(label="Transcript file name", placeholder="transcript")], gr.outputs.File(label="Download Transcript"), description="Fetch and download the transcript of a YouTube video as a human readable text file.", enable_queue=True ).launch()