Spaces:
Runtime error
Runtime error
init
Browse files- .gitignore +2 -0
- app.py +27 -0
- requirements.txt +1 -0
.gitignore
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
__pycache__/*
|
2 |
+
__pycache__
|
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from youtube_timestamper.core import YoutubeTimestamper
|
3 |
+
import datetime
|
4 |
+
|
5 |
+
def timestamp(url, q_thresh):
|
6 |
+
yt_timestamper = YoutubeTimestamper(url)
|
7 |
+
yt_timestamper.suggest_question_timestamps(q_thresh)
|
8 |
+
output=""
|
9 |
+
for t in yt_timestamper.timestamps:
|
10 |
+
timestamp = f"{datetime.timedelta(seconds=t[0])}"
|
11 |
+
timestamp = timestamp.split(".")[0].rjust(8, "0")
|
12 |
+
stamp = f"{timestamp} {t[1]}"
|
13 |
+
output += "\n" + stamp
|
14 |
+
output += "\n\nCreated using youtube-timestamper - https://ilangurudev.github.io/youtube-timestamper/"
|
15 |
+
return output.strip()
|
16 |
+
|
17 |
+
article = "Youtube Timestamper"
|
18 |
+
description = "Create timestamps for youtube interview videos using NLP."
|
19 |
+
|
20 |
+
iface = gr.Interface(fn=timestamp,
|
21 |
+
inputs=["text", gr.inputs.Slider(0, 50, 1, 15)],
|
22 |
+
outputs="text",
|
23 |
+
description=description,
|
24 |
+
article=article,
|
25 |
+
enable_queue=True,
|
26 |
+
examples=[["https://www.youtube.com/watch?v=QGCvycOXs2M", 20], ["https://www.youtube.com/watch?v=RvwynqDUoQE", 20]],)
|
27 |
+
iface.launch()
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
youtube-timestamper
|