-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.py
52 lines (40 loc) · 1.32 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
45
46
47
48
49
50
51
52
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
yamlInput2 = yaml.safe_load(input2)
app.logger.debug(yamlInput1)
print 'yamlInput2: ' + str(yamlInput2)
print yamlInput2
yamlInput3 = yaml.safe_load(input3)
app.logger.debug(yamlInput3)
print 'yamlInput3: ' + str(yamlInput3)
print yamlInput3
result = find_diff(yamlInput1, yamlInput2, yamlInput3)
print result
return render_template('compute.html', result=result)