Spaces:
Sleeping
Sleeping
4. 解題說明: 1. 步驟一, 2. 步驟二, 3. 步驟三....(最少三個步驟,最多五步驟)
Browse files
app.py
CHANGED
|
@@ -64,6 +64,9 @@ def process_image(image_url):
|
|
| 64 |
print(text)
|
| 65 |
print("========================")
|
| 66 |
question_json = json.loads(text_to_json(text))
|
|
|
|
|
|
|
|
|
|
| 67 |
return text, question_json
|
| 68 |
|
| 69 |
def image_to_text(url):
|
|
@@ -74,7 +77,7 @@ def image_to_text(url):
|
|
| 74 |
1. 題號:
|
| 75 |
2. 題目:
|
| 76 |
3. 選項:
|
| 77 |
-
4. 解題說明: 1. 步驟一, 2. 步驟二, 3. 步驟三....(
|
| 78 |
"""
|
| 79 |
|
| 80 |
response = OPEN_AI_CLIENT.chat.completions.create(
|
|
@@ -102,10 +105,10 @@ def image_to_text(url):
|
|
| 102 |
|
| 103 |
def text_to_json(text):
|
| 104 |
system_prompt = """
|
| 105 |
-
你是專業的轉譯器,看得懂題目,並保留 LATEX 語法(
|
| 106 |
"""
|
| 107 |
user_prompt = """
|
| 108 |
-
將以內容轉成 json,並保留 latex 語法(
|
| 109 |
|
| 110 |
包含 q_id, question 跟 choice 1~4, hint 1~5
|
| 111 |
{
|
|
|
|
| 64 |
print(text)
|
| 65 |
print("========================")
|
| 66 |
question_json = json.loads(text_to_json(text))
|
| 67 |
+
print("======text_to_json=====")
|
| 68 |
+
print(question_json)
|
| 69 |
+
print("========================")
|
| 70 |
return text, question_json
|
| 71 |
|
| 72 |
def image_to_text(url):
|
|
|
|
| 77 |
1. 題號:
|
| 78 |
2. 題目:
|
| 79 |
3. 選項:
|
| 80 |
+
4. 解題說明: 1. 步驟一, 2. 步驟二, 3. 步驟三....(最少三個步驟,最多五步驟)
|
| 81 |
"""
|
| 82 |
|
| 83 |
response = OPEN_AI_CLIENT.chat.completions.create(
|
|
|
|
| 105 |
|
| 106 |
def text_to_json(text):
|
| 107 |
system_prompt = """
|
| 108 |
+
你是專業的轉譯器,看得懂題目,並保留 LATEX 語法($...$),請轉成 json 格式
|
| 109 |
"""
|
| 110 |
user_prompt = """
|
| 111 |
+
將以內容轉成 json,並保留 latex 語法($...$),請一定要用 LATEX markdown 語法(前後用 $ 包起來的形式)
|
| 112 |
|
| 113 |
包含 q_id, question 跟 choice 1~4, hint 1~5
|
| 114 |
{
|