baohuynhbk14 commited on
Commit
b0883d9
·
1 Parent(s): d34de96

Fix history parameter handling in predict function and adjust question formatting in Conversation class

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. conversation.py +3 -1
app.py CHANGED
@@ -224,7 +224,7 @@ def predict(message,
224
  pixel_values,
225
  message,
226
  generation_config,
227
- history=None,
228
  return_history=True)
229
  logger.info(f"==== Conv History ====\n{conv_history}")
230
  return response, conv_history
 
224
  pixel_values,
225
  message,
226
  generation_config,
227
+ history=history,
228
  return_history=True)
229
  logger.info(f"==== Conv History ====\n{conv_history}")
230
  return response, conv_history
conversation.py CHANGED
@@ -148,8 +148,10 @@ class Conversation:
148
  # Check if it's the first user message and contains <image>
149
  if i == 0 and '<image>' in user_content:
150
  question = f"<image> {system_message}\n{user_content}"
151
- else:
152
  question = f"{system_message}\n{user_content}"
 
 
153
 
154
  # Check for the corresponding assistant response
155
  answer = ""
 
148
  # Check if it's the first user message and contains <image>
149
  if i == 0 and '<image>' in user_content:
150
  question = f"<image> {system_message}\n{user_content}"
151
+ elif i == 0 and '<imgage>' not in user_content:
152
  question = f"{system_message}\n{user_content}"
153
+ else:
154
+ question = f"{user_content}"
155
 
156
  # Check for the corresponding assistant response
157
  answer = ""