Spaces:
Runtime error
Runtime error
File size: 1,031 Bytes
351ec52 113e907 351ec52 |
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 |
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() |