Spaces:
Sleeping
Sleeping
refactor
Browse files
app.py
CHANGED
|
@@ -307,21 +307,15 @@ def process_youtube_link(link):
|
|
| 307 |
formatted_simple_transcript.append(simple_line)
|
| 308 |
screenshot_paths.append(screenshot_path)
|
| 309 |
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
print(html_content)
|
| 313 |
-
print("=====html_content=====")
|
| 314 |
|
| 315 |
# 基于逐字稿生成其他所需的输出
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
df_string_output = json.dumps(formatted_transcript, ensure_ascii=False, indent=2)
|
| 319 |
summary_json = get_video_id_summary(video_id, formatted_simple_transcript)
|
| 320 |
summary = summary_json["summary"]
|
| 321 |
-
|
| 322 |
-
global TRANSCRIPTS
|
| 323 |
-
TRANSCRIPTS = formatted_transcript
|
| 324 |
-
|
| 325 |
first_image = formatted_transcript[0]['screenshot_path']
|
| 326 |
first_text = formatted_transcript[0]['text']
|
| 327 |
|
|
@@ -329,7 +323,7 @@ def process_youtube_link(link):
|
|
| 329 |
return questions[0] if len(questions) > 0 else "", \
|
| 330 |
questions[1] if len(questions) > 1 else "", \
|
| 331 |
questions[2] if len(questions) > 2 else "", \
|
| 332 |
-
|
| 333 |
summary, \
|
| 334 |
html_content, \
|
| 335 |
first_image, \
|
|
|
|
| 307 |
formatted_simple_transcript.append(simple_line)
|
| 308 |
screenshot_paths.append(screenshot_path)
|
| 309 |
|
| 310 |
+
global TRANSCRIPTS
|
| 311 |
+
TRANSCRIPTS = formatted_transcript
|
|
|
|
|
|
|
| 312 |
|
| 313 |
# 基于逐字稿生成其他所需的输出
|
| 314 |
+
questions = generate_questions(formatted_simple_transcript)
|
| 315 |
+
formatted_transcript_json = json.dumps(formatted_transcript, ensure_ascii=False, indent=2)
|
|
|
|
| 316 |
summary_json = get_video_id_summary(video_id, formatted_simple_transcript)
|
| 317 |
summary = summary_json["summary"]
|
| 318 |
+
html_content = format_transcript_to_html(formatted_transcript)
|
|
|
|
|
|
|
|
|
|
| 319 |
first_image = formatted_transcript[0]['screenshot_path']
|
| 320 |
first_text = formatted_transcript[0]['text']
|
| 321 |
|
|
|
|
| 323 |
return questions[0] if len(questions) > 0 else "", \
|
| 324 |
questions[1] if len(questions) > 1 else "", \
|
| 325 |
questions[2] if len(questions) > 2 else "", \
|
| 326 |
+
formatted_transcript_json, \
|
| 327 |
summary, \
|
| 328 |
html_content, \
|
| 329 |
first_image, \
|