Spaces:
Running
Running
user_content = f"請根據 {content_text} 生成三個問題,並用 JSON 格式返回 questions:[q1的敘述text, q2的敘述text, q3的敘述text]"
Browse files
app.py
CHANGED
@@ -1014,9 +1014,13 @@ def get_questions(video_id, df_string, source="gcs"):
|
|
1014 |
|
1015 |
def generate_questions(df_string):
|
1016 |
# 使用 OpenAI 生成基于上传数据的问题
|
|
|
|
|
|
|
|
|
1017 |
|
1018 |
sys_content = "你是一個擅長資料分析跟影片教學的老師,user 為學生,請精讀資料文本,自行判斷資料的種類,並用既有資料為本質猜測用戶可能會問的問題,使用 zh-TW"
|
1019 |
-
user_content = f"請根據 {
|
1020 |
messages = [
|
1021 |
{"role": "system", "content": sys_content},
|
1022 |
{"role": "user", "content": user_content}
|
|
|
1014 |
|
1015 |
def generate_questions(df_string):
|
1016 |
# 使用 OpenAI 生成基于上传数据的问题
|
1017 |
+
df_string_json = json.loads(df_string)
|
1018 |
+
content_text = ""
|
1019 |
+
for entry in df_string_json:
|
1020 |
+
content_text += entry["text"] + ","
|
1021 |
|
1022 |
sys_content = "你是一個擅長資料分析跟影片教學的老師,user 為學生,請精讀資料文本,自行判斷資料的種類,並用既有資料為本質猜測用戶可能會問的問題,使用 zh-TW"
|
1023 |
+
user_content = f"請根據 {content_text} 生成三個問題,並用 JSON 格式返回 questions:[q1的敘述text, q2的敘述text, q3的敘述text]"
|
1024 |
messages = [
|
1025 |
{"role": "system", "content": sys_content},
|
1026 |
{"role": "user", "content": user_content}
|