chatcode / app.py
Arafath10's picture
Update app.py
f16f7b4
raw
history blame
613 Bytes
import gradio as gr
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
#from chatterbot.trainers import ChatterBotCorpusTrainer
from cleaner import clean_corpus
chatbot = ChatBot("Chatpot", database_uri="chat.db", readonly=True)
trainer = ListTrainer(chatbot)
CORPUS_FILE = "chat.txt"
trainer = ListTrainer(chatbot)
cleaned_corpus = clean_corpus(CORPUS_FILE)
trainer.train(cleaned_corpus)
print(cleaned_corpus)
def greet(name):
text = chatbot.get_response(name)
return "Hello " + str(text) + "!!"
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()