ChatterBot
ChatterBot copied to clipboard
Chatterbot not response
In my app... I put data Path and evrithing... change this 1000 forms.... I change to chatterbot 1.0.0 and nathing... I don't know what happen...
This is my app
from flask import Flask, render_template, request
from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
app = Flask(__name__, template_folder="templates")
chatbot = ChatBot('Toni')
corpus_path = 'virtualenv/toni/3.7/lib/python3.7/site-packages/chatterbot_corpus/data/english','virtualenv/toni/3.7/lib/python3.7/site-packages/chatterbot_corpus/data/spanish'
# Create a new trainer for the chatbot
trainer = ChatterBotCorpusTrainer(chatbot)
# Train the chatbot based on the english corpus
trainer.train("chatterbot.corpus.english")
# Train the chatbot based on the spanish corpus
trainer.train("chatterbot.corpus.spanish")
@app.route('/')
def home():
return render_template('index.html')
@app.route("/get")
def get_bot_response():
userText = request.args.get('msg')
return str(bot.get_response(userText))
if __name__ == "__main__":
from waitress import serve
app.config.update(
DEBUG=True,
SERVER_NAME="https://intercongreso.vps.co.ve:8080"
)
This is the template
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="/static/style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<center>
<div>
<div id="chatbox">
<p class="botText"><span>Hola soy Toni del Intercongreso Contoni .</span></p>
</div>
<div id="userInput">
<input id="textInput" type="text" name="msg" placeholder="Message">
<input id="buttonInput" type="submit" value="Send">
</div></center>
<script>
function getBotResponse() {
var rawText = $("#textInput").val();
var userHtml = '<p class="userText"><span>' + rawText + '</span></p>';
$("#textInput").val("");
$("#chatbox").append(userHtml);
document.getElementById('userInput').scrollIntoView({block: 'start', behavior: 'smooth'});
$.get("/get", { msg: rawText }).done(function(data) {
var botHtml = '<p class="botText"><span>' + data + '</span></p>';
$("#chatbox").append(botHtml);
document.getElementById('userInput').scrollIntoView({block: 'start', behavior: 'smooth'});
});
}
$("#textInput").keypress(function(e) {
if ((e.which == 13) && document.getElementById("textInput").value != "" ){
getBotResponse();
}
});
$("#buttonInput").click(function() {
if (document.getElementById("textInput").value != "") {
getBotResponse();
}
})
</script>
</div>
<center><h1>Aprobando a Toni.</h1>
<h3>Para informar del <a href="https://intercongreso.vps.co.ve">Intercongreso Contoni</a> y ayudar en tus proyectos.</h3>
</body>
</html>
pip freeze
appdirs==1.4.4
blis==0.7.4
catalogue==1.0.0
certifi==2020.6.20
chardet==3.0.4
ChatterBot==1.0.8
chatterbot-corpus==1.2.0
click==7.1.2
cymem==2.0.3
distlib==0.3.1
en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-2.3.1/en_core_web_sm-2.3.1.tar.gz
es-core-news-sm @ https://github.com/explosion/spacy-models/releases/download/es_core_news_sm-2.3.1/es_core_news_sm-2.3.1.tar.gz
filelock==3.0.12
fit==0.4.1
Flask==1.1.2
idna==2.10
importlib-metadata==1.7.0
itsdangerous==1.1.0
Jinja2==2.11.3
joblib==0.16.0
jsondatabase @ git+https://github.com/gunthercox/jsondb.git@d0d2c7e5fdb8c3c46c0373d59c130641349b1bc9
MarkupSafe==1.1.1
mathparse==0.1.2
murmurhash==1.0.2
nltk==3.5
numpy==1.19.1
packaging==20.4
Pint==0.14
plac==0.9.6
pluggy==0.13.1
preshed==3.0.5
py==1.10.0
pymongo==3.10.1
pyparsing==2.4.7
python-dateutil==2.8.1
pytz==2020.1
PyYAML==3.13
regex==2020.7.14
requests==2.24.0
six==1.15.0
spacy==2.3.5
SQLAlchemy==1.3.23
srsly==1.0.2
thinc==7.4.5
toml==0.10.2
tox==3.21.4
tqdm==4.48.0
urllib3==1.25.10
virtualenv==20.4.2
waitress==1.4.4
wasabi==0.7.1
Werkzeug==1.0.1
zipp==3.1.0
run Python app.py in ssh
python app.py
Training ai.yml: [####################] 100%
all is ok .... 100%
Flask run in ssh...
flask run
* Serving Flask app "app.py"
* Environment: development
* Debug mode: off
Training ai.yml: [####################] 100%
All is ok... 100%
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit
In app.py I write serve port 8080 and flask is port 5000 ... is good??? ... I don't know... I am musician... :(
The chatterbot receive the message but it does not respond nothing....
The chatbot is on line in this url
https://intercongreso.vps.co.ve/toni
Thanks a lots...