Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -21,13 +21,14 @@ with st.spinner('Wait for it... the model is loading'):
|
|
21 |
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
22 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
23 |
|
24 |
-
# Create a
|
25 |
-
input_text = st.
|
26 |
|
27 |
# Check if the user has entered a message
|
28 |
if input_text:
|
29 |
# Add the user's message to the conversation history
|
30 |
session_state.conversation_history.append(input_text)
|
|
|
31 |
|
32 |
# Create conversation history string
|
33 |
history_string = "\n".join(session_state.conversation_history)
|
@@ -43,10 +44,4 @@ if input_text:
|
|
43 |
|
44 |
# Add the model's response to the conversation history
|
45 |
session_state.conversation_history.append(response)
|
46 |
-
|
47 |
-
# Display the conversation history
|
48 |
-
st.write("Conversation History:")
|
49 |
-
for i in range(0, len(session_state.conversation_history), 2):
|
50 |
-
st.write("User: " + session_state.conversation_history[i])
|
51 |
-
if i+1 < len(session_state.conversation_history):
|
52 |
-
st.write("Assistant: " + session_state.conversation_history[i+1])
|
|
|
21 |
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
22 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
23 |
|
24 |
+
# Create a chat input for the user
|
25 |
+
input_text = st.chat_input("Enter your message:")
|
26 |
|
27 |
# Check if the user has entered a message
|
28 |
if input_text:
|
29 |
# Add the user's message to the conversation history
|
30 |
session_state.conversation_history.append(input_text)
|
31 |
+
st.chat_message("user", input_text)
|
32 |
|
33 |
# Create conversation history string
|
34 |
history_string = "\n".join(session_state.conversation_history)
|
|
|
44 |
|
45 |
# Add the model's response to the conversation history
|
46 |
session_state.conversation_history.append(response)
|
47 |
+
st.chat_message("assistant", response)
|
|
|
|
|
|
|
|
|
|
|
|