How to use Python ChatterBot in HTML page?

1

I'm developing a Chatbot in python, using the ChatterBot library. I would like to know how I can "embed" this chatbot into an HTML page.

  • I'm a beginner.
  • I use USB Web Server

Follow the code:

# -*- coding: utf-8 -*-
from chatterbot.trainers import ListTrainer

from chatterbot import ChatBot

bot = ChatBot('Bot')

nome = input('Digite seu nome: ')

conv = [
    'Oi',
    'Olá',
    'Tudo bem?',
    'Estou bem obrigado'
]

bot.set_trainer(ListTrainer)

bot.train(conv)

print('-='*40)

print('Bem Vindo ao Chat!')

print('-='*40)

while True:

    quest = input('Você: ')

    response = bot.get_response(quest)

    if float(response.confidence) > 0.5:

        print('Bot:', response)

    else:

        print('Bot: Não entendi, isso não está na minha base de dados')
    
asked by anonymous 14.01.2018 / 14:22

1 answer

0

You'll need to study a little bit about how HTTP requests and% s of HTML work to serve a page that communicates with your server.

For the server itself, you have options such as form and flask to receive and process requests. Django is powerful enough, but it can be tricky to use for a beginner and you most likely will not need all the features of it. I recommend therefore Django , which is very simple and will attend you.

    
14.01.2018 / 15:20