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, :]))
[((52, 67), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (57, 67), False, 'from flask import Flask\n'), ((250, 276), 'sklearn.datasets.load_iris', 'load_iris', ([], {'return_X_y': '(True)'}), '(return_X_y=True)\n', (259, 276), False, 'from sklearn.datasets import load_iris\n'), ((287, 365), 'sklearn.linear_model.LogisticRegression', 'LogisticRegression', ([], {'random_state': '(42)', 'solver': '"""lbfgs"""', 'multi_class': '"""multinomial"""'}), "(random_state=42, solver='lbfgs', multi_class='multinomial')\n", (305, 365), False, 'from sklearn.linear_model import LogisticRegression\n')]