diff --git a/app.py b/app.py index 4b159c9..853d683 100644 --- a/app.py +++ b/app.py @@ -2,7 +2,7 @@ import os from flask import Flask, render_template, redirect, url_for from flask.globals import request from werkzeug.utils import secure_filename -from workers import pdf2text +from workers import pdf2text, txt2questions # Constants UPLOAD_FOLDER = './pdf/' @@ -36,16 +36,20 @@ def quiz(): file_path = os.path.join( app.config['UPLOAD_FOLDER'], secure_filename(uploaded_file.filename)) file_exten = uploaded_file.filename.rsplit('.', 1)[1].lower() + questions = '' + # Save uploaded file uploaded_file.save(file_path) # Get contents of file uploaded_content = pdf2text(file_path, file_exten) + questions = txt2questions(uploaded_content) + # File upload + convert success if uploaded_content is not None: UPLOAD_STATUS = True except Exception as e: print(e) - return render_template('quiz.html', uploaded=UPLOAD_STATUS) + return render_template('quiz.html', uploaded=UPLOAD_STATUS, questions=questions, size=len(questions)) if __name__ == "__main__": diff --git a/info.txt b/info.txt deleted file mode 100644 index 5639b0b..0000000 --- a/info.txt +++ /dev/null @@ -1 +0,0 @@ -I have worked as a backend developer for creating REST API based based systems and worked with front-end integration for MEAN stack apps. For developing apps with a decoupled architecture. I have focused on security and performance to improve response time. I am well versed in Python, NodeJS and related tools like redis for building and maintaining a scalable architecture. I also have deployed production ready apps used by hundreds of people using AWS EC2, S3 and other cloud based tools. I frequently contribute to open source and support open source tools by creating issues, PRs for tools that I use frequently to try and give back to the community. \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 2f1f862..5141dfa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,39 @@ +blis==0.4.1 +catalogue==1.0.0 +certifi==2020.6.20 +chardet==3.0.4 click==7.1.2 +cymem==2.0.3 +en-core-web-md @ https://github.com/explosion/spacy-models/releases/download/en_core_web_md-2.3.1/en_core_web_md-2.3.1.tar.gz +en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.1/en_core_web_sm-2.3.1.tar.gz Flask==1.1.2 +gensim==3.8.3 +idna==2.10 +importlib-metadata==2.0.0 itsdangerous==1.1.0 Jinja2==2.11.2 +joblib==0.17.0 MarkupSafe==1.1.1 +murmurhash==1.0.2 +nltk==3.5 +numpy==1.19.2 pkg-resources==0.0.0 +plac==1.1.3 +preshed==3.0.2 PyPDF2==1.26.0 +regex==2020.9.27 +requests==2.24.0 +scikit-learn==0.23.2 +scipy==1.5.2 +six==1.15.0 +sklearn==0.0 +smart-open==3.0.0 +spacy==2.3.2 +srsly==1.0.2 +thinc==7.4.1 +threadpoolctl==2.1.0 +tqdm==4.50.2 +urllib3==1.25.10 +wasabi==0.8.0 Werkzeug==1.0.1 +zipp==3.3.0 diff --git a/templates/quiz.html b/templates/quiz.html index c3dd774..97c92cc 100644 --- a/templates/quiz.html +++ b/templates/quiz.html @@ -1,85 +1,54 @@ -
- - - - -