Kvikontent commited on
Commit
c2e9643
·
1 Parent(s): 5d31d58

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from chatterbot import ChatBot
3
+ from chatterbot.trainers import ChatterBotCorpusTrainer
4
+
5
+ # Create a chatbot
6
+ chatbot = ChatBot("KviGPT")
7
+ trainer = ChatterBotCorpusTrainer(chatbot)
8
+
9
+ # Use the English corpus to train the chatbot
10
+ trainer.train("chatterbot.corpus.english")
11
+
12
+ # Define the function to get the chatbot response
13
+ def get_response(input_text):
14
+ response = chatbot.get_response(input_text)
15
+ return str(response)
16
+
17
+ # Create the Streamlit app
18
+ st.title("KviGPT Chatbot")
19
+ user_input = st.text_area("You:", height=200)
20
+ if st.button("Send"):
21
+ bot_response = get_response(user_input)
22
+ st.text_area("KviGPT:", value=bot_response, height=200)