calmgoose commited on
Commit
54d1b4a
β€’
1 Parent(s): 44c115b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -10
app.py CHANGED
@@ -109,11 +109,13 @@ with st.sidebar:
109
 
110
  st.info("This isn't saved πŸ™ˆ")
111
 
112
- if "generated" not in st.session_state:
113
- st.session_state["generated"] = []
 
 
114
 
115
- if "past" not in st.session_state:
116
- st.session_state["past"] = []
117
 
118
  def get_text():
119
  user_input = st.text_input("You: ", "Who are you?", key="input")
@@ -132,11 +134,14 @@ if ask:
132
  except:
133
  output = "What's going on? That's not the right API key"
134
 
135
- st.session_state.past.append(user_input)
136
- st.session_state.generated.append(output)
137
 
138
- if st.session_state["generated"]:
 
 
139
 
140
- for i in range(len(st.session_state["generated"]) - 1, -1, -1):
141
- message(st.session_state["generated"][i], key=str(i))
142
- message(st.session_state["past"][i], is_user=True, key=str(i) + "_user")
 
 
 
109
 
110
  st.info("This isn't saved πŸ™ˆ")
111
 
112
+ # streamlit-chat not working
113
+ # i get this error: https://discuss.streamlit.io/t/your-app-is-having-trouble-loading-the-xxx-component/25046
114
+ # if "generated" not in st.session_state:
115
+ # st.session_state["generated"] = []
116
 
117
+ # if "past" not in st.session_state:
118
+ # st.session_state["past"] = []
119
 
120
  def get_text():
121
  user_input = st.text_input("You: ", "Who are you?", key="input")
 
134
  except:
135
  output = "What's going on? That's not the right API key"
136
 
137
+ st.text(label="1984:", value=output)
 
138
 
139
+ # streamlit-chat
140
+ # st.session_state.past.append(user_input)
141
+ # st.session_state.generated.append(output)
142
 
143
+ # if st.session_state["generated"]:
144
+
145
+ # for i in range(len(st.session_state["generated"]) - 1, -1, -1):
146
+ # message(st.session_state["generated"][i], key=str(i))
147
+ # message(st.session_state["past"][i], is_user=True, key=str(i) + "_user")