Chatterbot: Using trained chatterbot in Django view

Created on 8 Nov 2017  路  5Comments  路  Source: gunthercox/ChatterBot

i want to test my trained Chatterbot in a djano view like this:


from chatterbot import ChatBot
Male_bot = ChatBot(
    "Male_bot",
    storage_adapter={'import_path': 'chatterbot.storage.SQLStorageAdapter','database': 'Male'},
    logic_adapters=[{
            "import_path": "chatterbot.logic.BestMatch",},
            {
            'import_path': 'chatterbot.logic.LowConfidenceAdapter',
            'threshold': 0.95,
            'default_response': 'UNK' },])
 reply =  Male_bot.get_response(New_H)

i was using this way when i worked with it locally in my computer but with Django it seems to create a new instance.

So how i can use a trained Chatbot?

question

All 5 comments

Did you try to train the bot initially and export the model into .yml or .json files?

if not then you can export it as shown below

chatbot = ChatBot('Export Example Bot')
chatbot.trainer.export_for_training('./export.yml')

Later you can use this trained model in your django application by specifying the training data location in your settings.py file.

More details can be found here
http://chatterbot.readthedocs.io/en/stable/corpus.html?highlight=export

@vhr121 i created the chatterbot and locating the training corps in the setting file then i trained it with python3 manage.py train and the DB was created..in my view i just want to call this trained chatbot and use it

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings