Spaces:
Sleeping
Sleeping
debug process_transcript_and_screenshots_on_gcs
Browse files
app.py
CHANGED
|
@@ -372,6 +372,7 @@ def get_transcript_by_yt_api(video_id):
|
|
| 372 |
|
| 373 |
def generate_transcription_by_gemini(video_id):
|
| 374 |
"""δ½Ώη¨ Google Gemini ηζε½±ηιεη¨Ώ"""
|
|
|
|
| 375 |
# ζΊε YouTube ε½±η URL
|
| 376 |
video_url = f"https://www.youtube.com/watch?v={video_id}"
|
| 377 |
|
|
@@ -566,6 +567,7 @@ def process_transcript_and_screenshots_on_gcs(video_id):
|
|
| 566 |
print("====process_transcript_and_screenshots_on_gcs====")
|
| 567 |
transcript, exists = get_transcript_from_gcs(video_id)
|
| 568 |
if not exists:
|
|
|
|
| 569 |
try:
|
| 570 |
transcript = generate_transcription_by_gemini(video_id)
|
| 571 |
except Exception as e:
|
|
@@ -575,14 +577,15 @@ def process_transcript_and_screenshots_on_gcs(video_id):
|
|
| 575 |
upload_transcript_to_gcs(video_id, transcript)
|
| 576 |
|
| 577 |
# θηζͺε
|
|
|
|
| 578 |
is_new_transcript = False
|
| 579 |
has_tried_download_video = False
|
| 580 |
for entry in transcript:
|
| 581 |
if 'img_file_id' not in entry:
|
| 582 |
# ζͺ’ζ₯ OUTPUT_PATH ζ―ε¦εε¨ video_id.mp4
|
| 583 |
video_path = f'{OUTPUT_PATH}/{video_id}.mp4'
|
| 584 |
-
#
|
| 585 |
-
if not os.path.exists(video_path)
|
| 586 |
try:
|
| 587 |
download_youtube_video(video_id)
|
| 588 |
except Exception as e:
|
|
|
|
| 372 |
|
| 373 |
def generate_transcription_by_gemini(video_id):
|
| 374 |
"""δ½Ώη¨ Google Gemini ηζε½±ηιεη¨Ώ"""
|
| 375 |
+
print("====generate_transcription_by_gemini====")
|
| 376 |
# ζΊε YouTube ε½±η URL
|
| 377 |
video_url = f"https://www.youtube.com/watch?v={video_id}"
|
| 378 |
|
|
|
|
| 567 |
print("====process_transcript_and_screenshots_on_gcs====")
|
| 568 |
transcript, exists = get_transcript_from_gcs(video_id)
|
| 569 |
if not exists:
|
| 570 |
+
print("==== video transcript is not exists ====")
|
| 571 |
try:
|
| 572 |
transcript = generate_transcription_by_gemini(video_id)
|
| 573 |
except Exception as e:
|
|
|
|
| 577 |
upload_transcript_to_gcs(video_id, transcript)
|
| 578 |
|
| 579 |
# θηζͺε
|
| 580 |
+
print("====θηζͺε====")
|
| 581 |
is_new_transcript = False
|
| 582 |
has_tried_download_video = False
|
| 583 |
for entry in transcript:
|
| 584 |
if 'img_file_id' not in entry:
|
| 585 |
# ζͺ’ζ₯ OUTPUT_PATH ζ―ε¦εε¨ video_id.mp4
|
| 586 |
video_path = f'{OUTPUT_PATH}/{video_id}.mp4'
|
| 587 |
+
# ζ²ζε½±ηδ»₯εζ²ζδΈθΌι
|
| 588 |
+
if not os.path.exists(video_path) and not has_tried_download_video:
|
| 589 |
try:
|
| 590 |
download_youtube_video(video_id)
|
| 591 |
except Exception as e:
|