youngtsai commited on
Commit
ad2572c
·
1 Parent(s): e27706d

transcript = [entry for entry in transcript if entry['start'] <= video_length]

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -401,10 +401,7 @@ def process_transcript_and_screenshots_on_gcs(video_id):
401
  transcript = generate_transcription_by_whisper(video_id)
402
 
403
  video_length = get_video_duration(video_id)
404
- for entry in transcript:
405
- if entry['start'] > video_length:
406
- transcript.remove(entry)
407
-
408
  transcript_text = json.dumps(transcript, ensure_ascii=False, indent=2)
409
  GCS_SERVICE.upload_json_string(bucket_name, transcript_blob_name, transcript_text)
410
 
@@ -414,6 +411,7 @@ def process_transcript_and_screenshots_on_gcs(video_id):
414
  print("逐字稿已存在于GCS中")
415
  transcript_text = GCS_SERVICE.download_as_string(bucket_name, transcript_blob_name)
416
  transcript = json.loads(transcript_text)
 
417
 
418
  # print("===確認其他衍生文件===")
419
  # source = "gcs"
 
401
  transcript = generate_transcription_by_whisper(video_id)
402
 
403
  video_length = get_video_duration(video_id)
404
+ transcript = [entry for entry in transcript if entry['start'] <= video_length]
 
 
 
405
  transcript_text = json.dumps(transcript, ensure_ascii=False, indent=2)
406
  GCS_SERVICE.upload_json_string(bucket_name, transcript_blob_name, transcript_text)
407
 
 
411
  print("逐字稿已存在于GCS中")
412
  transcript_text = GCS_SERVICE.download_as_string(bucket_name, transcript_blob_name)
413
  transcript = json.loads(transcript_text)
414
+ transcript = [entry for entry in transcript if entry['start'] <= video_length]
415
 
416
  # print("===確認其他衍生文件===")
417
  # source = "gcs"