Spaces:
Sleeping
Sleeping
import streamlit as st | |
from chatterbot import ChatBot | |
from chatterbot.trainers import ChatterBotCorpusTrainer | |
# Create a chatbot | |
chatbot = ChatBot("KviGPT") | |
trainer = ChatterBotCorpusTrainer(chatbot) | |
# Use the English corpus to train the chatbot | |
trainer.train("chatterbot.corpus.english") | |
# Define the function to get the chatbot response | |
def get_response(input_text): | |
response = chatbot.get_response(input_text) | |
return str(response) | |
# Create the Streamlit app | |
st.title("KviGPT Chatbot") | |
user_input = st.text_area("You:", height=200) | |
if st.button("Send"): | |
bot_response = get_response(user_input) | |
st.text_area("KviGPT:", value=bot_response, height=200) | |