Spaces:
Sleeping
Sleeping
# === Chinese ===
Browse files
app.py
CHANGED
@@ -903,48 +903,6 @@ def get_past_exam_practice_log_session_content(file_name):
|
|
903 |
past_exam_refine_output, \
|
904 |
past_exam_save_output
|
905 |
|
906 |
-
# === Chinese ===
|
907 |
-
# def generate_chinese_evaluation_table(model, sys_content, user_prompt, text):
|
908 |
-
# # https://www.ceec.edu.tw/files/file_pool/1/0j052575870800204600/1216%E5%9C%8B%E6%96%87%E4%BD%9C%E6%96%87%E5%88%86%E9%A0%85%E5%BC%8F%E8%A9%95%E5%88%86%E6%8C%87%E6%A8%99.pdf
|
909 |
-
|
910 |
-
# user_content = f"""
|
911 |
-
# 本篇作文:{text}
|
912 |
-
# ---
|
913 |
-
# {user_prompt}
|
914 |
-
# """
|
915 |
-
# messages = [
|
916 |
-
# {"role": "system", "content": sys_content},
|
917 |
-
# {"role": "user", "content": user_content}
|
918 |
-
# ]
|
919 |
-
|
920 |
-
# response_format = { "type": "json_object" }
|
921 |
-
|
922 |
-
# request_payload = {
|
923 |
-
# "model": model,
|
924 |
-
# "messages": messages,
|
925 |
-
# "max_tokens": 2000,
|
926 |
-
# "response_format": response_format
|
927 |
-
# }
|
928 |
-
|
929 |
-
# response = OPEN_AI_CLIENT.chat.completions.create(**request_payload)
|
930 |
-
# content = response.choices[0].message.content
|
931 |
-
|
932 |
-
# print(f"====generate_chinese_evaluation_table====")
|
933 |
-
# print(content)
|
934 |
-
|
935 |
-
# data = json.loads(content)["results"]
|
936 |
-
# headers = ["架構", "評分", "解釋"]
|
937 |
-
# table_data = [
|
938 |
-
# ["主題與內容", data['主題與內容']['level'], data['主題與內容']['explanation']],
|
939 |
-
# ["段落結構", data['段落結構']['level'], data['段落結構']['explanation']],
|
940 |
-
# ["遣詞造句", data['遣詞造句']['level'], data['遣詞造句']['explanation']],
|
941 |
-
# ["錯別字與標點符號", data['錯別字與標點符號']['level'], data['錯別字與標點符號']['explanation']]
|
942 |
-
# ]
|
943 |
-
|
944 |
-
# gr_update = gr.update(value=table_data, headers=headers)
|
945 |
-
|
946 |
-
# return gr_update
|
947 |
-
|
948 |
def load_exam_data():
|
949 |
with open("exams.json", "r") as file:
|
950 |
data = json.load(file)
|
@@ -956,6 +914,8 @@ def update_exam_contents(selected_title):
|
|
956 |
if exam["title"] == selected_title:
|
957 |
return exam["title"], exam["question"], exam["hint"], exam["image_url"]
|
958 |
|
|
|
|
|
959 |
def generate_chinese_paragraph_practice_history(
|
960 |
user_data,
|
961 |
session_timestamp,
|
|
|
903 |
past_exam_refine_output, \
|
904 |
past_exam_save_output
|
905 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
906 |
def load_exam_data():
|
907 |
with open("exams.json", "r") as file:
|
908 |
data = json.load(file)
|
|
|
914 |
if exam["title"] == selected_title:
|
915 |
return exam["title"], exam["question"], exam["hint"], exam["image_url"]
|
916 |
|
917 |
+
|
918 |
+
# === Chinese ===
|
919 |
def generate_chinese_paragraph_practice_history(
|
920 |
user_data,
|
921 |
session_timestamp,
|