Spaces:
Runtime error
Runtime error
| from youtube_transcript_api import YouTubeTranscriptApi | |
| import gradio as gr | |
| from gradio.mix import Series | |
| def generate_transcript(url): | |
| id = url[url.index("=")+1:] | |
| transcript = YouTubeTranscriptApi.get_transcript(id) | |
| script = "" | |
| for text in transcript: | |
| t = text["text"] | |
| if t != '[Music]': | |
| script += t + " " | |
| return script | |
| transcriber = gr.Interface(generate_transcript, 'text', 'text') | |
| summarizer = gr.Interface.load("huggingface/sshleifer/distilbart-cnn-12-6") | |
| gradio_ui = Series(transcriber, summarizer, | |
| inputs = gr.inputs.Textbox(label = "Enter the YouTube URL below:"), | |
| examples = ["https://www.youtube.com/watch?v=Cu3R5it4cQs&list", "https://www.youtube.com/watch?v=HB4I2CgkcCo"], | |
| title = "YouTube Transcript Summarizer", | |
| theme = "peach", | |
| description = "This application summarize YouTube video that has English subtitles.Made by Amar.") | |
| gradio_ui.launch() |