chatcode / app.py
Arafath10's picture
Update app.py
81effc8
raw
history blame
833 Bytes
import gradio as gr
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
from chatterbot.trainers import ChatterBotCorpusTrainer
chatbot = ChatBot("Chatpot",storage_adapter='chatterbot.storage.SQLStorageAdapter',database_uri = 'sqlite:///database.sqlite3',
logic_adapters=[ {
"import_path": "chatterbot.logic.BestMatch"
}
])
#file1 = open("dialogs.txt", "r")
#training_data = file1.read().splitlines()
#trainer = ListTrainer(chatbot)
#trainer.train(training_data)
trainer = ChatterBotCorpusTrainer(chatbot)
trainer.train("chatterbot.corpus.english","chatterbot.corpus.english.ai")
#print(training_data)
def greet(name):
text = chatbot.get_response(name)
return str(text)
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()