Neurolingua
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -25,7 +25,7 @@ student_data=database[1]
|
|
25 |
def allowed_file(filename):
|
26 |
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
|
27 |
|
28 |
-
|
29 |
@app.route('/')
|
30 |
def index():
|
31 |
return render_template('index.html')
|
@@ -203,8 +203,8 @@ def get_student_profile():
|
|
203 |
import re
|
204 |
import re
|
205 |
|
206 |
-
def calculate_score_and_grades(
|
207 |
-
|
208 |
|
209 |
# Extract all the marks using a regular expression
|
210 |
marks = re.findall(r'(\d+)/(\d+)', llm_response)
|
@@ -245,7 +245,7 @@ def calculate_score_and_grades(llm_response):
|
|
245 |
def assign_grade():
|
246 |
data = request.json
|
247 |
result = data['result']
|
248 |
-
total_score, max_possible_score, percentage, grade = calculate_score_and_grades(
|
249 |
return jsonify({
|
250 |
'total_score': total_score,
|
251 |
'max_possible_score': max_possible_score,
|
@@ -480,6 +480,7 @@ def generate_paper():
|
|
480 |
|
481 |
@app.route('/eval', methods=['GET', 'POST'])
|
482 |
def eval():
|
|
|
483 |
if request.method == 'POST':
|
484 |
input_type = request.form['input_type']
|
485 |
question_text = ""
|
@@ -512,6 +513,7 @@ def eval():
|
|
512 |
answer_text = request.form['answer_text']
|
513 |
|
514 |
evaluation_result = evaluate(question_text, answer_text, max_marks)
|
|
|
515 |
print(f"Question Text: {question_text}") # Debugging line
|
516 |
print(f"Answer Text: {answer_text}") # Debugging line
|
517 |
print(f"Evaluation Result: {evaluation_result}") # Debugging line
|
|
|
25 |
def allowed_file(filename):
|
26 |
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
|
27 |
|
28 |
+
eval_str=''
|
29 |
@app.route('/')
|
30 |
def index():
|
31 |
return render_template('index.html')
|
|
|
203 |
import re
|
204 |
import re
|
205 |
|
206 |
+
def calculate_score_and_grades():
|
207 |
+
llm_response=eval_str
|
208 |
|
209 |
# Extract all the marks using a regular expression
|
210 |
marks = re.findall(r'(\d+)/(\d+)', llm_response)
|
|
|
245 |
def assign_grade():
|
246 |
data = request.json
|
247 |
result = data['result']
|
248 |
+
total_score, max_possible_score, percentage, grade = calculate_score_and_grades()
|
249 |
return jsonify({
|
250 |
'total_score': total_score,
|
251 |
'max_possible_score': max_possible_score,
|
|
|
480 |
|
481 |
@app.route('/eval', methods=['GET', 'POST'])
|
482 |
def eval():
|
483 |
+
global eval_str
|
484 |
if request.method == 'POST':
|
485 |
input_type = request.form['input_type']
|
486 |
question_text = ""
|
|
|
513 |
answer_text = request.form['answer_text']
|
514 |
|
515 |
evaluation_result = evaluate(question_text, answer_text, max_marks)
|
516 |
+
eval_str=evaluation_result
|
517 |
print(f"Question Text: {question_text}") # Debugging line
|
518 |
print(f"Answer Text: {answer_text}") # Debugging line
|
519 |
print(f"Evaluation Result: {evaluation_result}") # Debugging line
|