File size: 672 Bytes
c2e9643
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)