Spaces:
Sleeping
Sleeping
Update app.py
#1
by
IanRonk
- opened
app.py
CHANGED
@@ -12,13 +12,16 @@ article = "Check out [the original Rick and Morty Bot](https://huggingface.co/sp
|
|
12 |
|
13 |
|
14 |
def pipeline(video_url):
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
22 |
# return [
|
23 |
# {
|
24 |
# "start": "12:05",
|
|
|
12 |
|
13 |
|
14 |
def pipeline(video_url):
|
15 |
+
try:
|
16 |
+
video_id = video_url.split("?v=")[-1]
|
17 |
+
punctuated_text, transcript = punctuate(video_id)
|
18 |
+
sentences = re.split(r"[\.\!\?]\s", punctuated_text)
|
19 |
+
classification, probs = predict_from_document(sentences)
|
20 |
+
# return punctuated_text
|
21 |
+
times, timestamps = match_mask_and_transcript(sentences, transcript, classification)
|
22 |
+
return [{"begin": time[0], "end": time[1]} for time in times]
|
23 |
+
except Exception as e:
|
24 |
+
return {"error": f"{e}"}
|
25 |
# return [
|
26 |
# {
|
27 |
# "start": "12:05",
|