youngtsai commited on
Commit
81954df
1 Parent(s): 654c1bc
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -185,13 +185,13 @@ def process_file(file):
185
 
186
  # 根据上传的文件内容生成问题
187
  questions = generate_questions(df_string)
188
- df_summarise = generate_df_summarise(df_string)
189
 
190
  # 返回按钮文本和 DataFrame 字符串
191
  return questions[0] if len(questions) > 0 else "", \
192
  questions[1] if len(questions) > 1 else "", \
193
  questions[2] if len(questions) > 2 else "", \
194
- df_summarise, \
195
  df_string
196
 
197
  def df_to_text(df):
@@ -393,7 +393,7 @@ def get_video_id_summary(video_id, df_string):
393
  # 检查逐字稿是否存在
394
  exists, file_id = check_file_exists(service, folder_id, file_name)
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)
@@ -407,7 +407,7 @@ def get_video_id_summary(video_id, df_string):
407
  return summary_json
408
 
409
 
410
- def generate_df_summarise(df_string):
411
  # 使用 OpenAI 生成基于上传数据的问题
412
  sys_content = "你是一個擅長資料分析跟影片教學的老師,user 為學生,請精讀資料文本,自行判斷資料的種類,使用 zh-TW"
413
  user_content = f"""
 
185
 
186
  # 根据上传的文件内容生成问题
187
  questions = generate_questions(df_string)
188
+ summary = generate_summarise(df_string)
189
 
190
  # 返回按钮文本和 DataFrame 字符串
191
  return questions[0] if len(questions) > 0 else "", \
192
  questions[1] if len(questions) > 1 else "", \
193
  questions[2] if len(questions) > 2 else "", \
194
+ summary, \
195
  df_string
196
 
197
  def df_to_text(df):
 
393
  # 检查逐字稿是否存在
394
  exists, file_id = check_file_exists(service, folder_id, file_name)
395
  if not exists:
396
+ summary = generate_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)
 
407
  return summary_json
408
 
409
 
410
+ def generate_summarise(df_string):
411
  # 使用 OpenAI 生成基于上传数据的问题
412
  sys_content = "你是一個擅長資料分析跟影片教學的老師,user 為學生,請精讀資料文本,自行判斷資料的種類,使用 zh-TW"
413
  user_content = f"""