baohuynhbk14 commited on
Commit
4a3718d
·
1 Parent(s): 7d6b74d

Refactor predict function to retrieve user message using get_user_message method

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -231,7 +231,7 @@ def predict(state,
231
 
232
  history = state.get_history()
233
  logger.info(f"==== History ====\n{history}")
234
- message = history[-1][0] if len(history) > 0 else ""
235
 
236
  logger.info(f"==== Lenght Pixel values ====\n{len(pixel_values)}")
237
 
@@ -294,6 +294,7 @@ def ai_bot(
294
  # Stream output
295
  logger.info(f"==== Image paths ====\n{all_image_paths}")
296
 
 
297
  response, _ = predict(state,
298
  all_image_paths[0] if len(all_image_paths) > 0 else None,
299
  max_input_tiles,
 
231
 
232
  history = state.get_history()
233
  logger.info(f"==== History ====\n{history}")
234
+ _, message = state.get_user_message(source=state.USER, position='last')
235
 
236
  logger.info(f"==== Lenght Pixel values ====\n{len(pixel_values)}")
237
 
 
294
  # Stream output
295
  logger.info(f"==== Image paths ====\n{all_image_paths}")
296
 
297
+
298
  response, _ = predict(state,
299
  all_image_paths[0] if len(all_image_paths) > 0 else None,
300
  max_input_tiles,