File size: 601 Bytes
3fb88a6 ebb1297 3fb88a6 ebb1297 3fb88a6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
from flask import Flask, render_template, request
from retrieve_bot import ChatBot
import nltk
app = Flask(__name__)
nltk.download("punkt")
chatSheldon = ChatBot()
chatSheldon.load()
# this script is running flask application
@app.route("/")
def index():
return render_template("chat.html")
@app.route("/get", methods=["GET", "POST"])
def chat():
msg = request.form["msg"]
input = msg
return get_Chat_response(input)
def get_Chat_response(text):
answer = chatSheldon.generate_response(text)
return answer
if __name__ == "__main__":
app.run(debug=True, port=7860)
|