Spaces:
Runtime error
Runtime error
File size: 1,364 Bytes
18fcee7 78d6306 18fcee7 fc07315 18fcee7 fc07315 18fcee7 a41721f fc07315 18fcee7 |
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 29 |
import gradio as gr
from youtube_timestamper.core import YoutubeTimestamper
import datetime
def timestamp(url, q_thresh):
print(url)
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()
title = "Youtube Timestamper"
description = "Create timestamps for youtube interview videos using NLP."
article = "For more details visit https://ilangurudev.github.io/youtube-timestamper/ "
iface = gr.Interface(fn=timestamp,
inputs=[gr.inputs.Textbox(label="YouTube video url"), gr.inputs.Slider(0, 50, 1, 15, label="Maximum number of words between consecutive questions")],
outputs=gr.inputs.Textbox(label="Timestamps", lines=20),
title=title,
description=description,
article=article,
examples=[["https://www.youtube.com/watch?v=QGCvycOXs2M", 20], ["https://www.youtube.com/watch?v=RvwynqDUoQE", 20]],)
iface.launch() |