Implemented pdf upload

parent 891f32b9
import gradaudit.util as util
import gradaudit.extract as extract
from flask import Flask, render_template, request
from response import Response
from tempfile import NamedTemporaryFile
app = Flask(__name__)
@app.route('/')
@app.route('/',methods=['POST','GET'])
def input_form():
return render_template('GASGUI.html')
if request.method == 'GET':
return render_template('GASGUI.html')
else:
uploaded = request.files['transcriptPDF']
with NamedTemporaryFile() as fil:
uploaded.save(fil)
fil.flush()
course_data = extract.extract_courses(fil.name)
courses = map(lambda x: x[0], course_data)
courses = ','.join(courses)
return render_template('GASGUI.html',classes=courses)
@app.route('/upload',methods=['POST'])
def upload():
return render_template('GASGUI.html')
......@@ -21,7 +34,7 @@ def submit():
year = request.form['YearList']
spec = request.form['SpecializationOfDegree'].lower()
classes = request.form['classesTaken'].replace(' ','')
transcript = util.Transcript(name, degree, major, year, spec, classes)
transcript = util.Transcript(name, degree, major, year, spec, classes.split(','))
resp = Response(transcript)
......
Subproject commit 9affc399e8ea7a450300f8b5427e38c046f16780
Subproject commit 39429829383e9ed842d86fba06d09e1cca152540
......@@ -4,7 +4,7 @@
<h1>Graduation Audit System (GAS)</h1>
<p>This is an automated degree audit system for various degree plans at The University of Texas at Dallas.<br> Note: Audits may take between five seconds to a minute depending on degree plan. </p>
<script src="{{ url_for('static', filename='GAS.js') }}"></script>
<form action="/" method="post">
<form action="/" method="post" enctype="multipart/form-data">
<div>
<label for="transcriptPDF">Upload an unofficial transcript PDF or fill out the information manually</label>
<br>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment