File size: 1,048 Bytes
31806c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30dd301
 
 
 
 
 
31806c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30dd301
 
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, render_template, request
import numpy as np

from opts import options

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


def random_dataset(rows: int, features: int):
    """
    Initializes a training and a testing dataset in the form of numpy arrays
    """
    rng = np.random.default_rng()
    X = rng.normal(size=(rows, features))
    y = rng.integers(5, size=(rows, 1))
    return X, y


@app.route("/")
def index():
    return render_template("index.html")


@app.route("/process_algorithm", methods=["GET", "POST"])
def process_algorithm():
    alg = request.form.get('model-select')
    func = options[alg]

    # have a form for options based on the algorithm the user chose
    # and set it as the args variable, make a 'go' button for this funcitonality
    # to start the algorithm
    args = 0
    if args:
        # create random numpy array dataset
        X, y = random_dataset(100, 3)
        func(X, y, args)


if __name__ == '__main__':
    app.run(debug=True)