[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
477e7793af
commit
ad6839576e
1 changed files with 19 additions and 11 deletions
|
|
@ -1,17 +1,24 @@
|
||||||
from flask import Flask, request, jsonify
|
|
||||||
import numpy as np
|
|
||||||
from flask import Flask, request, render_template
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
from flask import jsonify
|
||||||
|
from flask import render_template
|
||||||
|
from flask import request
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@app.route('/', methods=['GET', 'POST'])
|
|
||||||
|
@app.route("/", methods=["GET", "POST"])
|
||||||
def home():
|
def home():
|
||||||
result = None
|
result = None
|
||||||
if request.method == 'POST':
|
if request.method == "POST":
|
||||||
# Get the comma-separated string, split by commas, and convert to integer
|
# Get the comma-separated string, split by commas, and convert to integer
|
||||||
s_data = np.array([int(i) for i in request.form.get('s_data', '').split(',') if i])
|
s_data = np.array(
|
||||||
ns_data = np.array([int(i) for i in request.form.get('ns_data', '').split(',') if i])
|
[int(i) for i in request.form.get("s_data", "").split(",") if i]
|
||||||
|
)
|
||||||
|
ns_data = np.array(
|
||||||
|
[int(i) for i in request.form.get("ns_data", "").split(",") if i]
|
||||||
|
)
|
||||||
|
|
||||||
total = sum(s_data) + sum(ns_data)
|
total = sum(s_data) + sum(ns_data)
|
||||||
|
|
||||||
|
|
@ -26,7 +33,7 @@ def home():
|
||||||
posterior_s = s_data / sum(s_data)
|
posterior_s = s_data / sum(s_data)
|
||||||
posterior_ns = ns_data / sum(ns_data)
|
posterior_ns = ns_data / sum(ns_data)
|
||||||
|
|
||||||
#likelihood
|
# likelihood
|
||||||
likelihood_s = marginal_prob_s
|
likelihood_s = marginal_prob_s
|
||||||
likelihood_ns = marginal_prob_ns
|
likelihood_ns = marginal_prob_ns
|
||||||
|
|
||||||
|
|
@ -38,10 +45,11 @@ def home():
|
||||||
"LIKELIHOOD_S": likelihood_s.tolist(),
|
"LIKELIHOOD_S": likelihood_s.tolist(),
|
||||||
"LIKELIHOOD_NS": likelihood_ns.tolist(),
|
"LIKELIHOOD_NS": likelihood_ns.tolist(),
|
||||||
"POSTERIOR_S": posterior_s.tolist(),
|
"POSTERIOR_S": posterior_s.tolist(),
|
||||||
"POSTERIOR_NS": posterior_ns.tolist()
|
"POSTERIOR_NS": posterior_ns.tolist(),
|
||||||
}
|
}
|
||||||
|
|
||||||
return render_template('index.html', result=result)
|
return render_template("index.html", result=result)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
|
if __name__ == "__main__":
|
||||||
app.run(debug=True)
|
app.run(debug=True)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue