def search_spammer(): # here to detect if the new review is a spam #return request.form["title"] min_score = 1 dup_no = dup.dup(min_score, request.args.get["text"]) # userid = "ALYU98KL3VUGF"/A1GLC0S9H532IU min_post = 1 early_constraint = 3600*24*180 # (sec*min)*hours*days*months detection_dict = dev.spammer_detect(request.args.get["userid"], min_post, early_constraint) #return str(devnrep_dict["time_diff"]) detection_dict["dup_no"] = dup_no detection_dict["metric"] = dev.metrics(detection_dict) #print detection_dict return render_template("result.html", result = detection_dict)
def validation(loader): loss = 0 prediction_list, target_list = [], [] for batch in loader: inputs, targets = batch predictions, targets, out = test_step(inputs, targets) loss += out prediction_list.append(predictions) target_list.append(targets) y_reco = tf.concat(prediction_list, axis=0) y_true = tf.concat(target_list, axis=0) y_true = tf.cast(y_true, tf.float32) loss, loss_from = loss_func(y_reco, y_true, re=True) energy, e_old, alpha, zeni, azi = metrics(y_reco, y_true) return loss, loss_from, [energy, e_old, alpha, zeni, azi]