schuler commited on
Commit
f7a2a53
·
verified ·
1 Parent(s): 2b469c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  import os
2
  from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig, pipeline
3
  import streamlit as st
@@ -125,6 +128,9 @@ with output_container:
125
  with st.chat_message(message['role'], avatar=st.session_state.avatars[message['role']]):
126
  st.markdown(message['content'])
127
 
 
 
 
128
  # When the user enters new text
129
  if st.session_state.user_text:
130
  # Display the user's message
 
1
+ # adapted from:
2
+ # https://medium.com/@james.irving.phd/creating-your-personal-chatbot-using-hugging-face-spaces-and-streamlit-596a54b9e3ed
3
+
4
  import os
5
  from transformers import AutoTokenizer, AutoModelForCausalLM, GenerationConfig, pipeline
6
  import streamlit as st
 
128
  with st.chat_message(message['role'], avatar=st.session_state.avatars[message['role']]):
129
  st.markdown(message['content'])
130
 
131
+ # User input area (moved to the bottom)
132
+ st.session_state.user_text = st.chat_input(placeholder="Enter your text here.")
133
+
134
  # When the user enters new text
135
  if st.session_state.user_text:
136
  # Display the user's message