Spaces:
Sleeping
Sleeping
summarise_json
Browse files
app.py
CHANGED
|
@@ -438,13 +438,30 @@ def generate_summarise(df_string):
|
|
| 438 |
以及可能的結論與結尾延伸小問題提供學生作反思
|
| 439 |
|
| 440 |
整體格式為:
|
| 441 |
-
1.
|
| 442 |
2. 整體摘要
|
| 443 |
3. 條列式重點
|
| 444 |
4. 關鍵時刻(段落摘要)
|
| 445 |
5. 結論反思(為什麼我們要學這個?)
|
| 446 |
6. 延伸小問題
|
| 447 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 448 |
"""
|
| 449 |
|
| 450 |
# 🗂️ 1. 內容類型:?
|
|
@@ -463,15 +480,20 @@ def generate_summarise(df_string):
|
|
| 463 |
"model": "gpt-4-1106-preview",
|
| 464 |
"messages": messages,
|
| 465 |
"max_tokens": 4000,
|
|
|
|
| 466 |
}
|
| 467 |
|
| 468 |
response = client.chat.completions.create(**request_payload)
|
| 469 |
-
|
| 470 |
-
print(
|
| 471 |
-
print(
|
| 472 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 473 |
|
| 474 |
-
return
|
| 475 |
|
| 476 |
|
| 477 |
def generate_questions(df_string):
|
|
|
|
| 438 |
以及可能的結論與結尾延伸小問題提供學生作反思
|
| 439 |
|
| 440 |
整體格式為:
|
| 441 |
+
1. 內容類型
|
| 442 |
2. 整體摘要
|
| 443 |
3. 條列式重點
|
| 444 |
4. 關鍵時刻(段落摘要)
|
| 445 |
5. 結論反思(為什麼我們要學這個?)
|
| 446 |
6. 延伸小問題
|
| 447 |
|
| 448 |
+
JSON format 為 {
|
| 449 |
+
"content_type": "資料",
|
| 450 |
+
"summary": "整體摘要",
|
| 451 |
+
"key_points": "條列式重點",
|
| 452 |
+
"key_moments": [
|
| 453 |
+
{
|
| 454 |
+
"start": "開始時間",
|
| 455 |
+
"end": "結束時間",
|
| 456 |
+
"text": "段落摘要"
|
| 457 |
+
},
|
| 458 |
+
...
|
| 459 |
+
],
|
| 460 |
+
]",
|
| 461 |
+
"conclusion_reflection": "結論反思(為什麼我們要學這個?)",
|
| 462 |
+
"extension_questions": "延伸小問題 LIST"
|
| 463 |
+
}
|
| 464 |
+
|
| 465 |
"""
|
| 466 |
|
| 467 |
# 🗂️ 1. 內容類型:?
|
|
|
|
| 480 |
"model": "gpt-4-1106-preview",
|
| 481 |
"messages": messages,
|
| 482 |
"max_tokens": 4000,
|
| 483 |
+
"response-format": {"type": "json_object"}
|
| 484 |
}
|
| 485 |
|
| 486 |
response = client.chat.completions.create(**request_payload)
|
| 487 |
+
print("====response====")
|
| 488 |
+
print(response)
|
| 489 |
+
print("====response====")
|
| 490 |
+
|
| 491 |
+
summarise_json = response.choices[0].message.content
|
| 492 |
+
print("=====summarise_json=====")
|
| 493 |
+
print(summarise_json)
|
| 494 |
+
print("=====summarise_json=====")
|
| 495 |
|
| 496 |
+
return summarise_json
|
| 497 |
|
| 498 |
|
| 499 |
def generate_questions(df_string):
|