Example #1
0
def predict():
    user_id = g.user['id']

    path = USER_PATH / str(g.user["id"])

    list_names = [f for f in os.listdir(path) if os.path.isfile((path / f))]

    annotation_list = []
    annotation_db = UserData.get_annotation_file(g.user["id"])
    for f in annotation_db:
        annotation_list.append([f['file_name'], f['path']])

    r = UserData.get_model(user_id)

    if r['accuracy'] is None:
        return redirect(url_for('modeling.index') + "?s=2")

    features = r['features'].split(',')
    trained_file = r['trained_file']
    clasifier = r['clasifier']
    accuracy = r['accuracy']
    accuracy = str(round(float(accuracy), 2))

    details = [features, trained_file, clasifier, accuracy]

    return render_template("modeling/predict.html",
                           available_list=list_names,
                           details=details,
                           annotation_list=annotation_list)
Example #2
0
def index():
    annotation_list = []
    path = USER_PATH / str(g.user["id"])

    list_names = [f for f in os.listdir(path) if os.path.isfile((path / f))]

    annotation_db = UserData.get_annotation_file(g.user["id"])
    for f in annotation_db:
        annotation_list.append([f['file_name'], f['path']])

    if len(list_names) == 0:
        flash("Error: You don't have uploaded file.")

    return render_template("preprocess/step-1.html",
                           available_list=list_names,
                           annotation_list=annotation_list)