-
Notifications
You must be signed in to change notification settings - Fork 3
/
app.py
48 lines (33 loc) · 1.17 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
from flask import Flask, render_template, redirect, request
import biomall as bm
import json
app = Flask(__name__)
@app.route('/recommend', methods=['POST'])
def recommend():
if request.method == "POST":
Title = request.form['Title']
names = ["Loba Chemle","HIMEDIA","BR Biochem Life Sciences","Aura Biotech","KT Labs","Bangalore GeNel","MERCK MILLIPORE","CYBERLAB","Sigma Aldrich"]
final = []
for i in names:
if i in request.form.keys():
final.append(i)
print(final)
bm.BIOMALL(query=Title)
with open('./dataBiomall.json') as f:
d = json.load(f)
with open('empty.txt', 'w') as json_file:
json.dump({}, json_file)
# print("dddddd", d)
d = d['Products']
# print("FINAL!!", d)
task, Title, allData = [1, Title, d]
return render_template('recommend.html', Title=Title, allData=allData, final = final)
@app.route('/')
def redirection():
return redirect('/home')
@app.route('/home')
def homePage():
return render_template('home.html')
if __name__ == '__main__':
app.debug = True
app.run()