Python &引用;ValueError配置格式不正确:'+;str((配置)当使用tensorflow和keras时?

Python &引用;ValueError配置格式不正确:'+;str((配置)当使用tensorflow和keras时?,python,tensorflow,machine-learning,keras,deep-learning,Python,Tensorflow,Machine Learning,Keras,Deep Learning,我正在使用图表方法进行聊天机器人响应。代码如下: def classify(sentence): # generate probabilities from the model p = bow(sentence, words) d = len(p) f = len(documents) - 2 a = np.zeros([f, d]) tot = np.vstack((p, a)) with graph.as_default():

我正在使用图表方法进行聊天机器人响应。代码如下:

def classify(sentence):
    # generate probabilities from the model
    p = bow(sentence, words)

    d = len(p)
    f = len(documents) - 2
    a = np.zeros([f, d])
    tot = np.vstack((p, a))

    with graph.as_default():
        json_file = open('chatbot/intent.json', 'r')
        loaded_model_json = json_file.read()
        json_file.close()
        loaded_model = model_from_json(loaded_model_json)
        loaded_model.load_weights("chatbot/chatmodel.h5")
        loaded_model.compile(loss='sparse_categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
        results = loaded_model.predict(tot)[0]

    # filter out predictions below a threshold
    results = [[i, r] for i, r in enumerate(results) if r > ERROR_THRESHOLD]
    # sort by strength of probability
    results.sort(key=lambda x: x[1], reverse=True)
    return_list = []

    for r in results:
        return_list.append((classes[r[0]], r[1]))

    # return tuple of intent and probability
    return return_list
但我得到了以下错误:

File "C:\python362\lib\site-packages\flask\app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "D:\INDUS-An-AI-E-Commerce-Web-Innovation-master\Ecommerce v1.0\app.py", line 1146, in get_bot_response
    res = response(userText, '123', min_acceptable_price, user_offer, original_price)
  File "D:\INDUS-An-AI-E-Commerce-Web-Innovation-master\Ecommerce v1.0\app.py", line 1076, in response
    results = classify(sentence)
  File "D:\INDUS-An-AI-E-Commerce-Web-Innovation-master\Ecommerce v1.0\app.py", line 977, in classify
    loaded_model = model_from_json(loaded_model_json)
  File "C:\python362\lib\site-packages\tensorflow\python\keras\saving\model_config.py", line 131, in model_from_json
    return deserialize(config, custom_objects=custom_objects)
  File "C:\python362\lib\site-packages\tensorflow\python\keras\layers\serialization.py", line 177, in deserialize
    printable_module_name='layer')
  File "C:\python362\lib\site-packages\tensorflow\python\keras\utils\generic_utils.py", line 347, in deserialize_keras_object
    config, module_objects, custom_objects, printable_module_name)
  File "C:\python362\lib\site-packages\tensorflow\python\keras\utils\generic_utils.py", line 291, in class_and_config_for_serialized_keras_object
    raise ValueError('Improper config format: ' + str(config))
ValueError: Improper config format: {'intents': [{'tag': 'identity', 'patterns': ['Who is talking?', 'Who is this?', 'Who are you?', 'What is your name?', 'What can i call you?', .....
基本上,每当用户进入机器人时,机器人都没有响应。除此之外,它还显示了这些错误。我尝试了很多方法,但都不起作用