ysharma HF staff commited on
Commit
838d28e
1 Parent(s): da458c2

Update app_dialogue.py

Browse files
Files changed (1) hide show
  1. app_dialogue.py +4 -0
app_dialogue.py CHANGED
@@ -578,6 +578,7 @@ with gr.Blocks(title="IDEFICS Playground", theme=gr.themes.Base()) as demo:
578
  query = prompt_list_to_tgi_input(formated_prompt_list)
579
  stream = client.generate_stream(prompt=query, **generation_args)
580
 
 
581
  acc_text = ""
582
  for idx, response in enumerate(stream):
583
  text_token = response.token.text
@@ -594,8 +595,11 @@ with gr.Blocks(title="IDEFICS Playground", theme=gr.themes.Base()) as demo:
594
  text_token = text_token.lstrip()
595
 
596
  acc_text += text_token
 
597
  last_turn = chat_history.pop(-1)
 
598
  last_turn[-1] += acc_text
 
599
  chat_history.append(last_turn)
600
  print(f"yields - chat_history -{chat_history} ")
601
  print(f"acc_text -{acc_text} ")
 
578
  query = prompt_list_to_tgi_input(formated_prompt_list)
579
  stream = client.generate_stream(prompt=query, **generation_args)
580
 
581
+ print(f"chat_history just before for loop - {chat_history}")
582
  acc_text = ""
583
  for idx, response in enumerate(stream):
584
  text_token = response.token.text
 
595
  text_token = text_token.lstrip()
596
 
597
  acc_text += text_token
598
+ print(f"acc_text - first - {acc_text}")
599
  last_turn = chat_history.pop(-1)
600
+ print(f"last_turn is - {last_turn}")
601
  last_turn[-1] += acc_text
602
+ print(f"last_turnp[-1] is - {last_turn[-1]}")
603
  chat_history.append(last_turn)
604
  print(f"yields - chat_history -{chat_history} ")
605
  print(f"acc_text -{acc_text} ")