|
import gradio as gr |
|
from chatterbot import ChatBot |
|
from chatterbot.trainers import ListTrainer |
|
|
|
|
|
|
|
chatbot = ChatBot("Chatpot",storage_adapter='chatterbot.storage.SQLStorageAdapter',database_uri = 'sqlite:///database.sqlite3') |
|
|
|
trainer = ListTrainer(chatbot) |
|
|
|
|
|
file1 = open("dialogs.txt", "r") |
|
training_data = file1.read().splitlines() |
|
trainer.train(training_data) |
|
print(training_data) |
|
|
|
|
|
|
|
def greet(name): |
|
text = chatbot.get_response(name) |
|
return "Hello " + str(text) + "!!" |
|
|
|
iface = gr.Interface(fn=greet, inputs="text", outputs="text") |
|
iface.launch() |