Gurudev's picture
init
18fcee7
raw
history blame
1.13 kB
import gradio as gr
from youtube_timestamper.core import YoutubeTimestamper
import datetime
def timestamp(url, q_thresh):
yt_timestamper = YoutubeTimestamper(url)
yt_timestamper.suggest_question_timestamps(q_thresh)
output=""
for t in yt_timestamper.timestamps:
timestamp = f"{datetime.timedelta(seconds=t[0])}"
timestamp = timestamp.split(".")[0].rjust(8, "0")
stamp = f"{timestamp} {t[1]}"
output += "\n" + stamp
output += "\n\nCreated using youtube-timestamper - https://ilangurudev.github.io/youtube-timestamper/"
return output.strip()
article = "Youtube Timestamper"
description = "Create timestamps for youtube interview videos using NLP."
iface = gr.Interface(fn=timestamp,
inputs=["text", gr.inputs.Slider(0, 50, 1, 15)],
outputs="text",
description=description,
article=article,
enable_queue=True,
examples=[["https://www.youtube.com/watch?v=QGCvycOXs2M", 20], ["https://www.youtube.com/watch?v=RvwynqDUoQE", 20]],)
iface.launch()