File size: 692 Bytes
e641e34 f48d575 6a397bd e641e34 f3af7d2 cd7f54a 292ff41 5b6bdce efdc6c0 6a397bd 292ff41 6a397bd 292ff41 6a397bd 5b6bdce cd7f54a e641e34 cd7f54a 292ff41 e641e34 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
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')
#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")
#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() |