youngtsai commited on
Commit
b1488d9
1 Parent(s): 38a8c25

summary_json = { "summary": str(summary) }

Browse files
Files changed (1) hide show
  1. app.py +2 -13
app.py CHANGED
@@ -91,17 +91,6 @@ def check_file_exists(service, folder_name, file_name):
91
  files = response.get('files', [])
92
  return len(files) > 0, files[0]['id'] if files else None
93
 
94
-
95
- def upload_to_drive(service, file_name, folder_id, content):
96
- print("上传文本内容到Google Drive指定的文件夹中")
97
- # 如果您的内容是字符串(文本),请使用io.StringIO
98
- # 对于二进制内容,请使用io.BytesIO
99
- file_metadata = {'name': file_name, 'parents': [folder_id]}
100
- # 这里我们假定content是文本,因此使用io.StringIO
101
- media = MediaFileUpload(io.StringIO(content), mimetype='text/plain')
102
-
103
- service.files().create(body=file_metadata, media_body=media, fields='id').execute()
104
-
105
  def upload_content_directly(service, file_name, folder_id, content):
106
  """
107
  直接将内容上传到Google Drive中的新文件。
@@ -465,8 +454,8 @@ def get_video_id_summary(video_id, df_string):
465
  if not exists:
466
  summary = generate_summarise(df_string)
467
  # processed_summary = processed_video_summary_to_json(summary)
468
- processed_summary = { "summary": str(summary) }
469
- summary_text = json.dumps(processed_summary, ensure_ascii=False, indent=2)
470
 
471
  # 存在 local at OUTPUT_PATH as {video_id}_summary.json
472
  with open(f'{OUTPUT_PATH}/{video_id}_summary.json', 'w') as f:
 
91
  files = response.get('files', [])
92
  return len(files) > 0, files[0]['id'] if files else None
93
 
 
 
 
 
 
 
 
 
 
 
 
94
  def upload_content_directly(service, file_name, folder_id, content):
95
  """
96
  直接将内容上传到Google Drive中的新文件。
 
454
  if not exists:
455
  summary = generate_summarise(df_string)
456
  # processed_summary = processed_video_summary_to_json(summary)
457
+ summary_json = { "summary": str(summary) }
458
+ summary_text = json.dumps(summary_json, ensure_ascii=False, indent=2)
459
 
460
  # 存在 local at OUTPUT_PATH as {video_id}_summary.json
461
  with open(f'{OUTPUT_PATH}/{video_id}_summary.json', 'w') as f: