Im new to deploying a website, all the functions in the deployed website already works but the chatbot inside the website doesnt respond to my queries. It works when i run it on my computer/localhost but doesnt when deployed. the chatbot gets responses from the intents.json and i already created the model from the train.py and already put them in their designated directories. the html file already has the needed codes and js script for the rendered chatbot so im not sure why it doesnt work. this is some of the codes in my app.py i think the problem is somewhere here probably
model = load_model("static/chatbot_model.h5")
intents = json.loads(open("static/intents.json").read())
words = pickle.load(open("static/words.pkl", "rb"))
classes = pickle.load(open("static/classes.pkl", "rb"))
app = Flask(__name__)
@app.route("/")
def home():
return render_template("Allpage.html")
@app.route("/get", methods=["POST"])
def chatbot_response():
msg = request.form["msg"]
if msg.startswith('my name is'):
name = msg[11:]
ints = predict_class(msg, model)
res1 = getResponse(ints, intents)
res =res1.replace("{n}",name)
elif msg.startswith('hi my name is'):
name = msg[14:]
ints = predict_class(msg, model)
res1 = getResponse(ints, intents)
res =res1.replace("{n}",name)
else:
ints = predict_class(msg, model)
res = getResponse(ints, intents)
return res
def getResponse(ints, intents_json):
tag = ints[0]["intent"]
list_of_intents = intents_json["intents"]
for i in list_of_intents:
if i["tag"] == tag:
result = random.choice(i["responses"])
break
return result
if __name__ == "__main__":
app.run()
Any help might do, Thank you :D