enoreyes commited on
Commit
dd1a630
1 Parent(s): 9121eec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -25,12 +25,14 @@ query_instruction = "Query the most relevant text from the BMW website"
25
  embeddings = HuggingFaceInstructEmbeddings(model_name=model_name, embed_instruction=embed_instruction, query_instruction=query_instruction)
26
  chain = RetrievalQAWithSourcesChain.from_chain_type(llm, chain_type="stuff", retriever=db.as_retriever(), memory=memory)
27
 
28
- def chat(message, site,history):
29
  history = history or []
30
  response = ""
31
  try:
32
  response = chain.run(input=message)
33
  markdown = generate_markdown(response)
 
 
34
  history.append((message, markdown))
35
 
36
  return history, history
@@ -58,6 +60,6 @@ with gr.Blocks() as demo:
58
  btn = gr.Button("Run").style(full_width=False)
59
  state = gr.State()
60
  agent_state = gr.State()
61
- btn.click(chat, [inp,site,state],[chatbot, state])
62
  if __name__ == '__main__':
63
  demo.launch()
 
25
  embeddings = HuggingFaceInstructEmbeddings(model_name=model_name, embed_instruction=embed_instruction, query_instruction=query_instruction)
26
  chain = RetrievalQAWithSourcesChain.from_chain_type(llm, chain_type="stuff", retriever=db.as_retriever(), memory=memory)
27
 
28
+ def chat(message, history):
29
  history = history or []
30
  response = ""
31
  try:
32
  response = chain.run(input=message)
33
  markdown = generate_markdown(response)
34
+ except Exception as e:
35
+ print(f"Erorr: {e}")
36
  history.append((message, markdown))
37
 
38
  return history, history
 
60
  btn = gr.Button("Run").style(full_width=False)
61
  state = gr.State()
62
  agent_state = gr.State()
63
+ btn.click(chat, [inp, state],[chatbot, state])
64
  if __name__ == '__main__':
65
  demo.launch()