handling duplicate avatar

#14
by ysharma HF staff - opened
Files changed (1) hide show
  1. app_dialogue.py +4 -6
app_dialogue.py CHANGED
@@ -289,7 +289,6 @@ def format_user_prompt_with_im_history_and_system_conditioning(
289
  # Format history
290
  for turn in history:
291
  user_utterance, assistant_utterance = turn
292
- assistant_utterance = assistant_utterance.replace(ASSISTANT_PREPEND, "")
293
  splitted_user_utterance = split_str_on_im_markdown(user_utterance)
294
 
295
  optional_space = ""
@@ -322,7 +321,6 @@ def format_user_prompt_with_im_history_and_system_conditioning(
322
  return resulting_list, current_user_prompt_list
323
 
324
 
325
- ASSISTANT_PREPEND = f"<img src='{IDEFICS_LOGO}' width='45'>"
326
  # dope_callback = gr.CSVLogger()
327
  # problematic_callback = gr.CSVLogger()
328
 
@@ -525,7 +523,7 @@ with gr.Blocks(title="IDEFICS Playground", theme=gr.themes.Base()) as demo:
525
 
526
  if image is None:
527
  # Case where there is no image OR the image is passed as `<fake_token_around_image><image:IMAGE_URL><fake_token_around_image>`
528
- chat_history.append([prompt_list_to_markdown(user_prompt_list), ASSISTANT_PREPEND])
529
  else:
530
  # Case where the image is passed through the Image Box.
531
  # Convert the image into base64 for both passing it through the chat history and
@@ -533,7 +531,7 @@ with gr.Blocks(title="IDEFICS Playground", theme=gr.themes.Base()) as demo:
533
  chat_history.append(
534
  [
535
  f"{prompt_list_to_markdown([image] + user_prompt_list)}",
536
- ASSISTANT_PREPEND,
537
  ]
538
  )
539
 
@@ -601,7 +599,7 @@ with gr.Blocks(title="IDEFICS Playground", theme=gr.themes.Base()) as demo:
601
 
602
  if image is None:
603
  # Case where there is no image OR the image is passed as `<fake_token_around_image><image:IMAGE_URL><fake_token_around_image>`
604
- chat_history.append([prompt_list_to_markdown(user_prompt_list), ASSISTANT_PREPEND])
605
  else:
606
  # Case where the image is passed through the Image Box.
607
  # Convert the image into base64 for both passing it through the chat history and
@@ -609,7 +607,7 @@ with gr.Blocks(title="IDEFICS Playground", theme=gr.themes.Base()) as demo:
609
  chat_history.append(
610
  [
611
  f"{prompt_list_to_markdown([image] + user_prompt_list)}",
612
- ASSISTANT_PREPEND,
613
  ]
614
  )
615
 
 
289
  # Format history
290
  for turn in history:
291
  user_utterance, assistant_utterance = turn
 
292
  splitted_user_utterance = split_str_on_im_markdown(user_utterance)
293
 
294
  optional_space = ""
 
321
  return resulting_list, current_user_prompt_list
322
 
323
 
 
324
  # dope_callback = gr.CSVLogger()
325
  # problematic_callback = gr.CSVLogger()
326
 
 
523
 
524
  if image is None:
525
  # Case where there is no image OR the image is passed as `<fake_token_around_image><image:IMAGE_URL><fake_token_around_image>`
526
+ chat_history.append([prompt_list_to_markdown(user_prompt_list), ''])
527
  else:
528
  # Case where the image is passed through the Image Box.
529
  # Convert the image into base64 for both passing it through the chat history and
 
531
  chat_history.append(
532
  [
533
  f"{prompt_list_to_markdown([image] + user_prompt_list)}",
534
+ '',
535
  ]
536
  )
537
 
 
599
 
600
  if image is None:
601
  # Case where there is no image OR the image is passed as `<fake_token_around_image><image:IMAGE_URL><fake_token_around_image>`
602
+ chat_history.append([prompt_list_to_markdown(user_prompt_list), ''])
603
  else:
604
  # Case where the image is passed through the Image Box.
605
  # Convert the image into base64 for both passing it through the chat history and
 
607
  chat_history.append(
608
  [
609
  f"{prompt_list_to_markdown([image] + user_prompt_list)}",
610
+ '',
611
  ]
612
  )
613