IanRonk commited on
Commit
2b42dc3
1 Parent(s): 30f607c
Files changed (1) hide show
  1. app.py +10 -7
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
- 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",
 
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",