Spaces:
Running
Running
image_path
Browse files
app.py
CHANGED
@@ -81,13 +81,14 @@ def process_youtube_link(link):
|
|
81 |
embed_url = get_embedded_youtube_link(video_id, entry['start'])
|
82 |
# 截圖
|
83 |
screenshot_path = screenshot_youtube_video(video_id, entry['start'])
|
|
|
84 |
line = {
|
85 |
"start_time": start_time,
|
86 |
"end_time": end_time,
|
87 |
"text": entry['text'],
|
88 |
"embed_url": embed_url,
|
89 |
"time_sec": entry['start'],
|
90 |
-
"
|
91 |
}
|
92 |
formatted_transcript.append(line)
|
93 |
|
@@ -110,7 +111,7 @@ def format_transcript_to_html(formatted_transcript):
|
|
110 |
for entry in formatted_transcript:
|
111 |
html_content += f"<h3>{entry['start_time']} - {entry['end_time']}</h3>"
|
112 |
html_content += f"<p>{entry['text']}</p>"
|
113 |
-
html_content += f"<img src='{entry['
|
114 |
return html_content
|
115 |
|
116 |
def get_embedded_youtube_link(video_id, start_time):
|
|
|
81 |
embed_url = get_embedded_youtube_link(video_id, entry['start'])
|
82 |
# 截圖
|
83 |
screenshot_path = screenshot_youtube_video(video_id, entry['start'])
|
84 |
+
image_path = os.path.join(os.path.dirname(__file__), screenshot_path),
|
85 |
line = {
|
86 |
"start_time": start_time,
|
87 |
"end_time": end_time,
|
88 |
"text": entry['text'],
|
89 |
"embed_url": embed_url,
|
90 |
"time_sec": entry['start'],
|
91 |
+
"image_path": image_path
|
92 |
}
|
93 |
formatted_transcript.append(line)
|
94 |
|
|
|
111 |
for entry in formatted_transcript:
|
112 |
html_content += f"<h3>{entry['start_time']} - {entry['end_time']}</h3>"
|
113 |
html_content += f"<p>{entry['text']}</p>"
|
114 |
+
html_content += f"<img src='{entry['image_path']}' width='500px' />"
|
115 |
return html_content
|
116 |
|
117 |
def get_embedded_youtube_link(video_id, start_time):
|