-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathapp.py
More file actions
35 lines (29 loc) · 949 Bytes
/
app.py
File metadata and controls
35 lines (29 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from flask import Flask, jsonify, render_template, request,url_for, redirect
from random import choice
from OMR import OMR_Evaluator
import os
app = Flask(__name__)
@app.route('/')
def main():
return render_template('index.html')
@app.route('/upload',methods = ['GET','POST'])
def upload():
if request.method == 'POST':
f = request.files['omr']
img_name = f.filename
f.save(img_name)
key = []
f = request.files['key']
key_name = f.filename
f.save(key_name)
with open(key_name) as fs:
option = fs.readlines()
for o in option:
key.append(tuple(str(o).split()))
print(key)
obj = OMR_Evaluator(img_name,key)
os.remove(img_name)
os.remove(key_name)
return render_template('result.html', enroll = obj.enroll, score = obj.student_score)
if __name__ == "__main__":
app.run(debug = True)