schuler commited on
Commit
911228e
·
verified ·
1 Parent(s): 56d3998

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -96,13 +96,13 @@ def get_response(system_message, chat_history, user_text, max_new_tokens=256, co
96
  for message in chat_history:
97
  role = "<|assistant|>" if message['role'] == 'assistant' else "<|user|>"
98
  prompt += f"\n{role}\n{message['content']}\n"
99
- prompt += f"\n<|user|>\n{user_text}\n<|assistant|>\n"
100
 
101
  if continue_last:
102
  # We want to continue the last assistant response
103
- prompt += "Assistant:"
104
  else:
105
- prompt += f"User: {user_text}\nAssistant:"
106
 
107
  # Generate the response
108
  response_output = generator(
@@ -150,9 +150,6 @@ with chat_interface:
150
  # User input area (moved to the bottom)
151
  st.session_state.user_text = st.chat_input(placeholder="Enter your text here.")
152
 
153
- # User input area (moved to the bottom)
154
- st.session_state.user_text = st.chat_input(placeholder="Enter your text here.")
155
-
156
  # When the user enters new text
157
  if st.session_state.user_text:
158
  # Display the user's message
 
96
  for message in chat_history:
97
  role = "<|assistant|>" if message['role'] == 'assistant' else "<|user|>"
98
  prompt += f"\n{role}\n{message['content']}\n"
99
+
100
 
101
  if continue_last:
102
  # We want to continue the last assistant response
103
+ # prompt += ""
104
  else:
105
+ prompt += f"\n<|user|>\n{user_text}\n<|assistant|>\n"
106
 
107
  # Generate the response
108
  response_output = generator(
 
150
  # User input area (moved to the bottom)
151
  st.session_state.user_text = st.chat_input(placeholder="Enter your text here.")
152
 
 
 
 
153
  # When the user enters new text
154
  if st.session_state.user_text:
155
  # Display the user's message