-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
32 lines (22 loc) · 726 Bytes
/
Copy pathserver.py
File metadata and controls
32 lines (22 loc) · 726 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
from flask import Flask, render_template, request, jsonify, send_file
import predict
import os
app = Flask(__name__, static_folder="static/")
count = 0
@app.route('/')
def index():
return render_template('index.html')
@app.route('/analyze', methods=['POST'])
def analyze():
global count
data = request.get_json()
dna_sequence = data['dna_sequence']
count = count + 1
analysis_result = predict.predict(dna_sequence, count)
return jsonify({'result': analysis_result})
@app.route('/download')
def download():
global count
return send_file(f"static/analysis/analysis_{str(count)}.pdf", as_attachment=True)
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=8080)