Skip to content

Commit e20571c

Browse files
committed
UI design Almost complete
1 parent 75e1d49 commit e20571c

File tree

12 files changed

+303
-17
lines changed

12 files changed

+303
-17
lines changed

backend/api/api.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import time
44
import numpy
55

6+
7+
#Globals
68
app = Flask(__name__)
79
CORS(app)
810

@@ -14,8 +16,11 @@ def test():
1416
def analyze_text():
1517
data = request.get_json()
1618
text = data['text']
19+
subject = data['subject']
20+
21+
print(subject, text)
1722

18-
#Your Input is the variable "text"
23+
#Your Input are the variables "text" and "subject"
1924

2025
Output = None #Call Model Here
2126

backend/api/test_api.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1-
from flask import Flask, request, jsonify
1+
from flask import Flask, request, jsonify, abort
22
from flask_cors import CORS
3+
from werkzeug.utils import secure_filename
34
import time
45
import numpy
56

7+
UPLOAD_FOLDER = "./attachments"
8+
ALLOWED_EXTENSIONS = {'txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'}
9+
610
app = Flask(__name__)
11+
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
712
CORS(app)
813

14+
#Extension_Check
15+
def allowed_file(filename):
16+
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
17+
918
@app.route("/", methods=['GET'])
1019
def test():
1120
return "Hello World!"
@@ -37,6 +46,15 @@ def analyze_text():
3746

3847
return jsonify(reply)
3948

40-
# @app.route("/analyzeattachment", methods=['POST'])
41-
# def analyze_attachment():
42-
49+
@app.route("/analyzeattachment", methods=['POST'])
50+
def analyze_attachment():
51+
if 'file' not in request.files:
52+
abort(400, description="Resource not found")
53+
file = request.files['file']
54+
# if user does not select file, browser also submit an empty part without filename
55+
if file.filename == '':
56+
abort(400, description="Resource not found")
57+
if file and allowed_file(file.filename):
58+
filename = secure_filename(file.filename)
59+
file.filename = filename
60+
return jsonify(file)

frontend/package-lock.json

Lines changed: 171 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "frontend",
3+
"homepage": "http://Lakshya31.github.io/ShellPrivacyFilterDemo",
34
"version": "0.1.0",
45
"private": true,
56
"dependencies": {
@@ -9,6 +10,7 @@
910
"bootstrap": "^4.5.2",
1011
"foundation-sites": "^6.6.3",
1112
"react": "^16.13.1",
13+
"react-confirm-alert": "^2.6.2",
1214
"react-dom": "^16.13.1",
1315
"react-particles-js": "^3.3.0",
1416
"react-scripts": "3.4.3"
@@ -17,7 +19,10 @@
1719
"start": "react-scripts start",
1820
"build": "react-scripts build",
1921
"test": "react-scripts test",
20-
"eject": "react-scripts eject"
22+
"eject": "react-scripts eject",
23+
"pushtotree": "git subtree push --prefix frontend origin gh-pages",
24+
"predeploy": "npm run build",
25+
"deploy": "gh-pages -d build"
2126
},
2227
"eslintConfig": {
2328
"extends": "react-app"
@@ -33,5 +38,8 @@
3338
"last 1 firefox version",
3439
"last 1 safari version"
3540
]
41+
},
42+
"devDependencies": {
43+
"gh-pages": "^3.1.0"
3644
}
3745
}

0 commit comments

Comments
 (0)