File size: 1,128 Bytes
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
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()