更新时间:2023-11-23 08:21:16
model.predict()
期望第一个参数是一个numpy数组.您提供了一个列表,该列表不具有numpy数组具有的shape
属性.
否则,您的代码看起来不错,除了您对预测不执行任何操作.确保将其存储在变量中,例如:
Otherwise your code looks fine, except that you are doing nothing with the prediction. Make sure you store it in a variable, for example like this:
prediction = model.predict(np.array(tk.texts_to_sequences(text)))
print(prediction)