ryanrwatkins commited on
Commit
2fa4c6f
1 Parent(s): 32cae03

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -657,7 +657,7 @@ Standalone question: {question}"""
657
 
658
  def answer_template(language="english"):
659
  """Pass the standalone question along with the chat history and context
660
- to the `LLM` wihch will answer"""
661
 
662
  template = f"""Answer the question (convert to {language} language if it is not) at the end, using only the following context (delimited by <context></context>).
663
  Your answer must be in the language at the end.
@@ -778,7 +778,7 @@ Standalone question: {question}""")
778
  def submit_message(prompt, prompt_template, temperature, max_tokens, context_length, state):
779
 
780
 
781
- #history = state['messages']
782
 
783
 
784
  #global prompt_template_name
@@ -797,7 +797,11 @@ def submit_message(prompt, prompt_template, temperature, max_tokens, context_len
797
 
798
 
799
  get_empty_state()
 
 
800
  state['content'] = completion
 
 
801
  #state.append(completion.copy())
802
 
803
  completion = { "content": completion }
@@ -837,7 +841,6 @@ def submit_message(prompt, prompt_template, temperature, max_tokens, context_len
837
 
838
 
839
  def clear_conversation():
840
- memory.clear()
841
  return gr.update(value=None, visible=True), None, "", get_empty_state()
842
 
843
 
@@ -876,7 +879,7 @@ with gr.Blocks(css=css) as demo:
876
 
877
  btn_submit = gr.Button("Submit")
878
  #total_tokens_str = gr.Markdown(elem_id="total_tokens_str")
879
- btn_clear_conversation = gr.Button("Start New Conversation")
880
 
881
 
882
  with gr.Column(visible=False):
 
657
 
658
  def answer_template(language="english"):
659
  """Pass the standalone question along with the chat history and context
660
+ to the `LLM` which will answer"""
661
 
662
  template = f"""Answer the question (convert to {language} language if it is not) at the end, using only the following context (delimited by <context></context>).
663
  Your answer must be in the language at the end.
 
778
  def submit_message(prompt, prompt_template, temperature, max_tokens, context_length, state):
779
 
780
 
781
+ history = state['messages']
782
 
783
 
784
  #global prompt_template_name
 
797
 
798
 
799
  get_empty_state()
800
+
801
+
802
  state['content'] = completion
803
+
804
+
805
  #state.append(completion.copy())
806
 
807
  completion = { "content": completion }
 
841
 
842
 
843
  def clear_conversation():
 
844
  return gr.update(value=None, visible=True), None, "", get_empty_state()
845
 
846
 
 
879
 
880
  btn_submit = gr.Button("Submit")
881
  #total_tokens_str = gr.Markdown(elem_id="total_tokens_str")
882
+ btn_clear_conversation = gr.Button("Start New Conversation", visible=False)
883
 
884
 
885
  with gr.Column(visible=False):