Spaces:
Sleeping
Sleeping
# 處理截圖
Browse files
app.py
CHANGED
|
@@ -449,10 +449,12 @@ def process_transcript_and_screenshots_on_gcs(video_id):
|
|
| 449 |
transcript_text = download_blob_to_string(gcs_client, bucket_name, transcript_blob_name)
|
| 450 |
transcript = json.loads(transcript_text)
|
| 451 |
|
|
|
|
| 452 |
source = "gcs"
|
| 453 |
get_questions(video_id, transcript_text, source)
|
| 454 |
get_video_id_summary(video_id, transcript_text, source)
|
| 455 |
get_mind_map(video_id, transcript_text, source)
|
|
|
|
| 456 |
|
| 457 |
# 處理截圖
|
| 458 |
# for entry in transcript:
|
|
@@ -464,15 +466,16 @@ def process_transcript_and_screenshots_on_gcs(video_id):
|
|
| 464 |
# print(f"截图已上传到GCS: {img_file_id}")
|
| 465 |
|
| 466 |
# 更新逐字稿文件
|
| 467 |
-
print("===更新逐字稿文件===")
|
| 468 |
-
print(transcript)
|
| 469 |
-
print("===更新逐字稿文件===")
|
| 470 |
-
updated_transcript_text = json.dumps(transcript, ensure_ascii=False, indent=2)
|
| 471 |
-
upload_file_to_gcs_with_json_string(gcs_client, bucket_name, transcript_blob_name, updated_transcript_text)
|
| 472 |
-
print("逐字稿已更新,包括截图链接")
|
| 473 |
-
updated_transcript_json = json.loads(updated_transcript_text)
|
| 474 |
-
|
| 475 |
-
return updated_transcript_json
|
|
|
|
| 476 |
|
| 477 |
def process_youtube_link(link):
|
| 478 |
# 使用 YouTube API 获取逐字稿
|
|
|
|
| 449 |
transcript_text = download_blob_to_string(gcs_client, bucket_name, transcript_blob_name)
|
| 450 |
transcript = json.loads(transcript_text)
|
| 451 |
|
| 452 |
+
print("===確認其他衍生文件===")
|
| 453 |
source = "gcs"
|
| 454 |
get_questions(video_id, transcript_text, source)
|
| 455 |
get_video_id_summary(video_id, transcript_text, source)
|
| 456 |
get_mind_map(video_id, transcript_text, source)
|
| 457 |
+
print("===確認其他衍生文件 end ===")
|
| 458 |
|
| 459 |
# 處理截圖
|
| 460 |
# for entry in transcript:
|
|
|
|
| 466 |
# print(f"截图已上传到GCS: {img_file_id}")
|
| 467 |
|
| 468 |
# 更新逐字稿文件
|
| 469 |
+
# print("===更新逐字稿文件===")
|
| 470 |
+
# print(transcript)
|
| 471 |
+
# print("===更新逐字稿文件===")
|
| 472 |
+
# updated_transcript_text = json.dumps(transcript, ensure_ascii=False, indent=2)
|
| 473 |
+
# upload_file_to_gcs_with_json_string(gcs_client, bucket_name, transcript_blob_name, updated_transcript_text)
|
| 474 |
+
# print("逐字稿已更新,包括截图链接")
|
| 475 |
+
# updated_transcript_json = json.loads(updated_transcript_text)
|
| 476 |
+
|
| 477 |
+
# return updated_transcript_json
|
| 478 |
+
return transcript
|
| 479 |
|
| 480 |
def process_youtube_link(link):
|
| 481 |
# 使用 YouTube API 获取逐字稿
|