Update teacher_function.py
Browse files- teacher_function.py +13 -12
teacher_function.py
CHANGED
|
@@ -54,25 +54,24 @@ def extract_text_from_image(image_path):
|
|
| 54 |
return text
|
| 55 |
|
| 56 |
|
| 57 |
-
|
| 58 |
def evaluate(question, answer, max_marks):
|
| 59 |
prompt = f"""Questions: {question}
|
| 60 |
-
Answer: {answer}
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
-
|
| 63 |
-
- If the answer is
|
| 64 |
-
- If the answer is
|
| 65 |
-
- If the answer is good but not completely accurate, give full marks minus 1.
|
| 66 |
-
- If the answer is somewhat accurate, give full marks minus 2, and so on.
|
| 67 |
-
- Ensure that the length and detail of the answers correspond to the maximum marks available.
|
| 68 |
|
| 69 |
-
Provide the results in the following format:
|
| 70 |
|
| 71 |
-
|
| 72 |
-
|
|
|
|
| 73 |
|
| 74 |
messages = [
|
| 75 |
-
{"role": "system", "content": "You are
|
| 76 |
{"role": "user", "content": prompt}
|
| 77 |
]
|
| 78 |
|
|
@@ -84,6 +83,8 @@ Total marks: """
|
|
| 84 |
):
|
| 85 |
if chunk.choices[0].delta.content:
|
| 86 |
response_content += chunk.choices[0].delta.content
|
|
|
|
|
|
|
| 87 |
return response_content
|
| 88 |
|
| 89 |
def generate_student_report(name, age, cgpa, course, assigned_test, ai_test, interests, difficulty, courses_taken):
|
|
|
|
| 54 |
return text
|
| 55 |
|
| 56 |
|
|
|
|
| 57 |
def evaluate(question, answer, max_marks):
|
| 58 |
prompt = f"""Questions: {question}
|
| 59 |
+
Answer: {answer}.
|
| 60 |
+
Evaluate answers strictly one by one(if there are multiple) for each question and assign marks out of {max_marks} based on below guidelines.
|
| 61 |
+
guidelines:
|
| 62 |
+
- If the answer is wrong or incorrect or irrelevent to topic, give 0 marks.
|
| 63 |
|
| 64 |
+
- If the answer is somewhat accurate, give total marks minus 2, and so on.
|
| 65 |
+
- If the answer is very accurate and complete, give total marks.
|
| 66 |
+
- If the answer is good but not completely accurate, give total marks minus 1.
|
|
|
|
|
|
|
|
|
|
| 67 |
|
|
|
|
| 68 |
|
| 69 |
+
Note:Provide only marks for each answers. dont provide anything other than that.
|
| 70 |
+
Format:
|
| 71 |
+
1.Question no: Marks,etc"""
|
| 72 |
|
| 73 |
messages = [
|
| 74 |
+
{"role": "system", "content": "You are a strict answer evaluator. "},
|
| 75 |
{"role": "user", "content": prompt}
|
| 76 |
]
|
| 77 |
|
|
|
|
| 83 |
):
|
| 84 |
if chunk.choices[0].delta.content:
|
| 85 |
response_content += chunk.choices[0].delta.content
|
| 86 |
+
print(response_content)
|
| 87 |
+
|
| 88 |
return response_content
|
| 89 |
|
| 90 |
def generate_student_report(name, age, cgpa, course, assigned_test, ai_test, interests, difficulty, courses_taken):
|