-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
55 lines (40 loc) · 1.42 KB
/
app.py
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import os
from flask import Flask, request, render_template, send_from_directory
from helper import Predictor
app = Flask(__name__)
@app.route('/<path:page>')
def show(page):
return render_template('%s.html' % page)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/results', methods=['post'])
def results():
sequences = request.form['sequence']
pred = Predictor()
seq = "MGSVRKASAWLGLVDDNDDERYYDDDYAEGQESGEAWVTDPRVKVASETAEEKGRRIGTVTPDSFRDARGIGELFRDGVPVIINLTAMEPTDAKRVVDF" \
"AAGLTFGLRGTIERVATRVFLLTPANTEIVSGEAAGRPTDGFFNQS"
clf = pred.RFInit()
data = clf.predict(pred.LSTMPredict(sequences.upper()))
print(data[0])
send = 0
if data[0] == 1:
# send = "Protein is Soluble"
send = 1
else:
# send = "Protein is Insoluble"
send = 0
return render_template('results.html', prediction=send, name=sequences.upper())
# @app.route('/singleSequence/<string:sequence>', methods=['GET'])
# def singleSequence(sequence):
# return sequence
@app.route('/favicon.ico')
def favicon():
return send_from_directory(os.path.join(app.root_path, 'static'), 'favicon.ico',
mimetype='image/vnd.microsoft.icon')
@app.errorhandler(404)
def not_found(error):
return "Not Found", 404
if __name__ == '__main__':
port = int(os.environ.get('PORT', 5000))
app.run(debug=True, host="0.0.0.0", port=port)