-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.py
44 lines (32 loc) · 1.04 KB
/
demo.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
from flask import Flask
from flask import render_template
from flask import request
from algorithm import *
import yaml
app = Flask(__name__)
import logging
logging.basicConfig(filename='example.log',level=logging.DEBUG)
@app.route('/')
def hello_world():
return 'Hello, World!'
@app.route('/compute', methods=['GET', 'POST'])
def compute():
if request.method == 'GET':
return render_template('compute.html')
else:
input1 = request.form['input1']
app.logger.debug(input1)
print ('input1: ' + input1)
input2 = request.form['input2']
app.logger.debug(input2)
print ('input2: ' + input2)
input3 = request.form['input3']
app.logger.debug(input3)
print ('input3: ' + input3)
yamlInput1 = yaml.safe_load(input1)
app.logger.debug(yamlInput1)
print ('yamlInput1: ' + str(yamlInput1))
print yamlInput1
result = mulsearch(yamlInput1, input2, input3)
print result
return render_template('compute.html', result=result)