predict.py 502 B

123456789101112
  1. def predict():
  2. """
  3. @summary: 预测数据
  4. """
  5. test_x,doc_id,ent_id,sen,ent_text,dianhua = get_data()
  6. model = models.load_model("model_person.model",
  7. custom_objects={'precision': precision,
  8. 'recall': recall,
  9. 'f1_score': f1_score}
  10. )
  11. predict_y = model.predict([test_x[0], test_x[1]])
  12. label = [np.argmax(y) for y in predict_y]