def ask(): # kernel now ready for use while True: message = str(request.form['messageText']) if message == "quit": aimodule.record() elif message == "save": aimodule.saveBrain("bot_brain.brn") elif message == "#elp": aimodule.incident() else: bot_response = aimodule.respond(message) # print bot_response return jsonify({'status': 'OK', 'answer': bot_response})
def ask(): # kernel now ready for use while True: message = str(request.form['messageText']) m1 = message[:5] if message == "quit": aimodule.record() elif message == "save": aimodule.saveBrain("bot_brain.brn") elif message == "#elp": aimodule.incident() else: bot_response = aimodule.respond(message) sen_response = sentiment.predict(message) resp = bot_response + "---" + sen_response #print sen_response logger.debug(sen_response) return jsonify({'status': 'OK', 'answer': resp})