Spaces:
Runtime error
Runtime error
bigfix
Browse files
app.py
CHANGED
|
@@ -228,8 +228,8 @@ def get_transcript(video_id):
|
|
| 228 |
transcript_list = yta.list_transcripts(video_id)
|
| 229 |
transcript_item = transcript_list.find_transcript(['en'])
|
| 230 |
except (NoTranscriptFound, TranscriptsDisabled) as e:
|
| 231 |
-
transcript_item =
|
| 232 |
-
transcript_text =
|
| 233 |
transcript_item_is_generated = False
|
| 234 |
return transcript_text, transcript_item_is_generated
|
| 235 |
|
|
@@ -245,6 +245,11 @@ def get_transcript(video_id):
|
|
| 245 |
|
| 246 |
def get_meta_info(video_id, url):
|
| 247 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
yt_img = f'http://img.youtube.com/vi/{video_id}/mqdefault.jpg'
|
| 249 |
yt_img_html = '<img src='+yt_img+' width="250" height="150" />'
|
| 250 |
yt_img_html_link = '<a href='+url+'>'+yt_img_html+'</a>'
|
|
@@ -263,7 +268,7 @@ def get_meta_info(video_id, url):
|
|
| 263 |
'Characters': [int(st.session_state.extract[3])],
|
| 264 |
'Tokens':[int(st.session_state.extract[4])],
|
| 265 |
'Lextext':[st.session_state.extract[0]],
|
| 266 |
-
'GPTSummary':[
|
| 267 |
df_current_ts = pd.DataFrame({**video_info,**transcript_info})
|
| 268 |
|
| 269 |
return df_current_ts
|
|
@@ -361,9 +366,9 @@ st.write("")
|
|
| 361 |
|
| 362 |
transcript_text, transcript_item_is_generated = get_transcript(video_id)
|
| 363 |
|
| 364 |
-
if transcript_text is None:
|
| 365 |
-
st.error("No transcript available.")
|
| 366 |
-
st.stop()
|
| 367 |
|
| 368 |
########################
|
| 369 |
# Load Author Keywords, that are not viewable by users
|
|
@@ -607,9 +612,6 @@ if st.button('Load Sequence'):
|
|
| 607 |
|
| 608 |
transcript_text, transcript_item_is_generated = get_transcript(subsng)
|
| 609 |
|
| 610 |
-
if transcript_text is None:
|
| 611 |
-
continue
|
| 612 |
-
|
| 613 |
if transcript_item_is_generated:
|
| 614 |
get_punctuated_text(transcript_text)
|
| 615 |
else:
|
|
|
|
| 228 |
transcript_list = yta.list_transcripts(video_id)
|
| 229 |
transcript_item = transcript_list.find_transcript(['en'])
|
| 230 |
except (NoTranscriptFound, TranscriptsDisabled) as e:
|
| 231 |
+
transcript_item = 'No Transcript available.'
|
| 232 |
+
transcript_text = 'No Transcript available.'
|
| 233 |
transcript_item_is_generated = False
|
| 234 |
return transcript_text, transcript_item_is_generated
|
| 235 |
|
|
|
|
| 245 |
|
| 246 |
def get_meta_info(video_id, url):
|
| 247 |
|
| 248 |
+
lextext = st.session_state.extract[0]
|
| 249 |
+
gpt_sum = '0'
|
| 250 |
+
if len(lextext) < 10:
|
| 251 |
+
gpt_sum = 'NA'
|
| 252 |
+
|
| 253 |
yt_img = f'http://img.youtube.com/vi/{video_id}/mqdefault.jpg'
|
| 254 |
yt_img_html = '<img src='+yt_img+' width="250" height="150" />'
|
| 255 |
yt_img_html_link = '<a href='+url+'>'+yt_img_html+'</a>'
|
|
|
|
| 268 |
'Characters': [int(st.session_state.extract[3])],
|
| 269 |
'Tokens':[int(st.session_state.extract[4])],
|
| 270 |
'Lextext':[st.session_state.extract[0]],
|
| 271 |
+
'GPTSummary':[gpt_sum]}
|
| 272 |
df_current_ts = pd.DataFrame({**video_info,**transcript_info})
|
| 273 |
|
| 274 |
return df_current_ts
|
|
|
|
| 366 |
|
| 367 |
transcript_text, transcript_item_is_generated = get_transcript(video_id)
|
| 368 |
|
| 369 |
+
#if transcript_text is None:
|
| 370 |
+
# st.error("No transcript available.")
|
| 371 |
+
# st.stop()
|
| 372 |
|
| 373 |
########################
|
| 374 |
# Load Author Keywords, that are not viewable by users
|
|
|
|
| 612 |
|
| 613 |
transcript_text, transcript_item_is_generated = get_transcript(subsng)
|
| 614 |
|
|
|
|
|
|
|
|
|
|
| 615 |
if transcript_item_is_generated:
|
| 616 |
get_punctuated_text(transcript_text)
|
| 617 |
else:
|