danidanidani commited on
Commit
3ec9efb
·
1 Parent(s): 15ba625

Update src/backend/chatbot.py

Browse files
Files changed (1) hide show
  1. src/backend/chatbot.py +3 -2
src/backend/chatbot.py CHANGED
@@ -117,8 +117,9 @@ def chat_response(template, prompt_text, model, demo_lite):
117
  # return response.content
118
  elif model == "Llama2-7b_CPP" or model == "deci-7b_CPP":
119
  print("BP 5.1: running full demo, model: ", model)
120
- llm = init_llm(model, demo_lite)
121
- response = llm.complete(template + prompt_text)
 
122
  return response.text
123
  else:
124
  print("Error with chatbot model")
 
117
  # return response.content
118
  elif model == "Llama2-7b_CPP" or model == "deci-7b_CPP":
119
  print("BP 5.1: running full demo, model: ", model)
120
+ if 'llm' not in st.session_state:
121
+ st.session_state.llm = init_llm(model, demo_lite)
122
+ response = st.session_state.llm.complete(template + prompt_text)
123
  return response.text
124
  else:
125
  print("Error with chatbot model")