Kvikontent commited on
Commit
08a9b60
·
1 Parent(s): 3e13a7d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import streamlit as st
2
- from freeGPT import Client
3
 
4
- @st.cache_data
5
  def get_response(user_input):
6
  try:
7
  response = client.create_completion("gpt3", user_input)
@@ -10,6 +10,10 @@ def get_response(user_input):
10
  except Exception as e:
11
  return "Error: {}".format(str(e))
12
 
13
- st.sidebar.title("KviGPT", help="By KVI Kontent")
14
  st.sidebar.subheader("Chat based on Gpt-3")
15
- user_input = st.chat_input("Say something", on_submit=get_response(user_input))
 
 
 
 
 
1
  import streamlit as st
2
+ from freegpt import Client
3
 
4
+ @st.cache(ttl=3600)
5
  def get_response(user_input):
6
  try:
7
  response = client.create_completion("gpt3", user_input)
 
10
  except Exception as e:
11
  return "Error: {}".format(str(e))
12
 
13
+ st.sidebar.title("KviGPT")
14
  st.sidebar.subheader("Chat based on Gpt-3")
15
+
16
+ user_input = st.chat_input("Say something")
17
+
18
+ if user_input:
19
+ get_response(user_input)