Spaces:
Sleeping
Sleeping
summary_text = json.dumps(summary_json, ensure_ascii=False, indent=2)
Browse files
app.py
CHANGED
|
@@ -316,7 +316,8 @@ def process_youtube_link(link):
|
|
| 316 |
# questions = generate_questions(formatted_simple_transcript)
|
| 317 |
questions = ["","",""]
|
| 318 |
df_string_output = json.dumps(formatted_transcript, ensure_ascii=False, indent=2)
|
| 319 |
-
|
|
|
|
| 320 |
|
| 321 |
global TRANSCRIPTS
|
| 322 |
TRANSCRIPTS = formatted_transcript
|
|
@@ -394,14 +395,16 @@ def get_video_id_summary(video_id, df_string):
|
|
| 394 |
if not exists:
|
| 395 |
summary = generate_df_summarise(df_string)
|
| 396 |
summary_json = {"summary", summary}
|
| 397 |
-
|
|
|
|
| 398 |
print("summary已上传到Google Drive")
|
| 399 |
else:
|
| 400 |
# 逐字稿已存在,下载逐字稿内容
|
| 401 |
print("summary已存在于Google Drive中")
|
| 402 |
-
|
|
|
|
| 403 |
|
| 404 |
-
return
|
| 405 |
|
| 406 |
|
| 407 |
def generate_df_summarise(df_string):
|
|
|
|
| 316 |
# questions = generate_questions(formatted_simple_transcript)
|
| 317 |
questions = ["","",""]
|
| 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
|
|
|
|
| 395 |
if not exists:
|
| 396 |
summary = generate_df_summarise(df_string)
|
| 397 |
summary_json = {"summary", summary}
|
| 398 |
+
summary_text = json.dumps(summary_json, ensure_ascii=False, indent=2)
|
| 399 |
+
file_id = upload_content_directly(service, file_name, folder_id, summary_text)
|
| 400 |
print("summary已上传到Google Drive")
|
| 401 |
else:
|
| 402 |
# 逐字稿已存在,下载逐字稿内容
|
| 403 |
print("summary已存在于Google Drive中")
|
| 404 |
+
summary_text = download_file_as_string(service, file_id)
|
| 405 |
+
summary_json = json.loads(summary_text)
|
| 406 |
|
| 407 |
+
return summary_json
|
| 408 |
|
| 409 |
|
| 410 |
def generate_df_summarise(df_string):
|