from flask import Flask

# initialize the app
app = Flask(__name__)

# execute iris function at /iris route
@app.route("/iris")
def iris():
    from sklearn.datasets import load_iris
    from sklearn.linear_model import LogisticRegression
    X, y = load_iris(return_X_y=True)
    clf = LogisticRegression(
        random_state = 42,
        solver="lbfgs",
        multi_class="multinomial"
    ).fit(X, y)

    return str(clf.predict(X[:2, :]))
[((4, 6, 4, 21), 'flask.Flask', 'Flask', ({(4, 12, 4, 20): '__name__'}, {}), '(__name__)', False, 'from flask import Flask\n'), ((11, 11, 11, 37), 'sklearn.datasets.load_iris', 'load_iris', (), '', False, 'from sklearn.datasets import load_iris\n'), ((12, 10, 16, 5), 'sklearn.linear_model.LogisticRegression', 'LogisticRegression', (), '', False, 'from sklearn.linear_model import LogisticRegression\n')]