Spaces:
Running
Running
video_length = get_video_duration(video_id)
Browse files
app.py
CHANGED
@@ -384,6 +384,7 @@ def process_transcript_and_screenshots_on_gcs(video_id):
|
|
384 |
# 检查逐字稿是否存在
|
385 |
is_new_transcript = False
|
386 |
is_transcript_exists = GCS_SERVICE.check_file_exists(bucket_name, transcript_blob_name)
|
|
|
387 |
if not is_transcript_exists:
|
388 |
print("逐字稿文件不存在于GCS中,重新建立")
|
389 |
# 从YouTube获取逐字稿并上传
|
@@ -400,7 +401,6 @@ def process_transcript_and_screenshots_on_gcs(video_id):
|
|
400 |
print("沒有找到字幕")
|
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)
|
|
|
384 |
# 检查逐字稿是否存在
|
385 |
is_new_transcript = False
|
386 |
is_transcript_exists = GCS_SERVICE.check_file_exists(bucket_name, transcript_blob_name)
|
387 |
+
video_length = get_video_duration(video_id)
|
388 |
if not is_transcript_exists:
|
389 |
print("逐字稿文件不存在于GCS中,重新建立")
|
390 |
# 从YouTube获取逐字稿并上传
|
|
|
401 |
print("沒有找到字幕")
|
402 |
transcript = generate_transcription_by_whisper(video_id)
|
403 |
|
|
|
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)
|