Spaces:
Sleeping
Sleeping
File size: 877 Bytes
714bc51 2c9d2bf 31806c5 6377159 31806c5 f31d9cf e571d8c f31d9cf e571d8c 31806c5 28d5b3d 24f2542 f38f95f 33e7a34 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 |
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
# just for simplicity sake
X, y = iris()
app = Flask(__name__)
CORS(app, origins="*")
@app.route("/neural-network", methods=["POST"])
def neural_network():
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)
|