youngtsai commited on
Commit
524e031
1 Parent(s): 635201c

trascript_text = json.dumps(trascript_json, ensure_ascii=False, indent=2)

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -1028,8 +1028,15 @@ def chat_with_youtube_transcript(youtube_id, thread_id, trascript, user_message,
1028
  # """
1029
 
1030
  # 直接安排逐字稿資料 in instructions
 
 
 
 
 
 
 
1031
  instructions = f"""
1032
- 逐字稿資料:{trascript}
1033
  -------------------------------------
1034
  你是一個擅長資料分析跟影片教學的老師,user 為學生
1035
  如果是影片類型,不用解釋逐字稿格式,直接回答學生問題
 
1028
  # """
1029
 
1030
  # 直接安排逐字稿資料 in instructions
1031
+ trascript_json = json.loads(trascript)
1032
+ # 移除 embed_url, screenshot_path
1033
+ for entry in trascript_json:
1034
+ entry.pop('embed_url', None)
1035
+ entry.pop('screenshot_path', None)
1036
+ trascript_text = json.dumps(trascript_json, ensure_ascii=False, indent=2)
1037
+
1038
  instructions = f"""
1039
+ 逐字稿資料:{trascript_text}
1040
  -------------------------------------
1041
  你是一個擅長資料分析跟影片教學的老師,user 為學生
1042
  如果是影片類型,不用解釋逐字稿格式,直接回答學生問題