Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,16 +12,13 @@ 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 [{"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",
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
def pipeline(video_url):
|
| 15 |
+
video_id = video_url.split("?v=")[-1]
|
| 16 |
+
punctuated_text, transcript = punctuate(video_id)
|
| 17 |
+
sentences = re.split(r"[\.\!\?]\s", punctuated_text)
|
| 18 |
+
classification, probs = predict_from_document(sentences)
|
| 19 |
+
# return punctuated_text
|
| 20 |
+
times, timestamps = match_mask_and_transcript(sentences, transcript, classification)
|
| 21 |
+
return [{"begin": time[0], "end": time[1]} for time in times]
|
|
|
|
|
|
|
|
|
|
| 22 |
# return [
|
| 23 |
# {
|
| 24 |
# "start": "12:05",
|