File size: 1,023 Bytes
f31d9cf
2c9d2bf
31806c5
6377159
31806c5
 
f31d9cf
 
 
31806c5
 
 
 
 
f31d9cf
 
 
 
24f2542
 
f31d9cf
6f847ac
f31d9cf
f04bbb4
 
f31d9cf
 
f04bbb4
f31d9cf
6377159
deecb43
f31d9cf
 
 
 
 
 
 
 
 
 
 
 
f04bbb4
3cab2dd
 
 
f31d9cf
3cab2dd
6377159
3cab2dd
c2ccf60
31806c5
3563daa
a18c74f
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
53
54
55
56
from flask import Flask, request, jsonify, render_template
from flask_cors import CORS

from dataset.iris import iris
from opts import options

# using the iris data set for every algorithm
X, y = iris()

app = Flask(
    __name__,
    template_folder="templates",
)

CORS(
    app=app,
    origins="*",
)


@app.route("/", methods=["GET"])
def index():
    return render_template("index.html")


@app.route("/neural-network", methods=["POST", "GET"])
def neural_network():
    # parse arguments
    algorithm = options["neural-network"]
    args = request.json["arguments"]

    result = algorithm(
        X=X,
        y=y,
        args=args,
    )
    return jsonify(result)


@app.route("/kmeans-clustering", methods=["POST"])
def kmeans():
    algorithm = options["kmeans-clustering"]
    args = request.json["arguments"]

    result = algorithm(
        X=X,
        y=y,
        clusterer="kmeans-clustering",
        args=args,
    )
    return jsonify(result)


if __name__ == "__main__":
    app.run(debug=False)