Spaces:
Sleeping
Sleeping
Update functions/punctuation.py
#2
by
IanRonk
- opened
- functions/punctuation.py +10 -7
functions/punctuation.py
CHANGED
|
@@ -49,10 +49,13 @@ def parse_output(output, comb):
|
|
| 49 |
|
| 50 |
|
| 51 |
def punctuate(video_id):
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
|
| 51 |
def punctuate(video_id):
|
| 52 |
+
try:
|
| 53 |
+
transcript = retrieve_transcript(video_id)
|
| 54 |
+
splits = split_transcript(
|
| 55 |
+
transcript
|
| 56 |
+
) # Get the transcript from the YoutubeTranscriptApi
|
| 57 |
+
resp = query_punctuation(splits) # Get the response from the Inference API
|
| 58 |
+
punctuated_transcript = parse_output(resp, splits)
|
| 59 |
+
return punctuated_transcript, transcript
|
| 60 |
+
except Exception as e:
|
| 61 |
+
return None, str(e)
|