iamviveksrk commited on
Commit
2ea27b8
β€’
1 Parent(s): bd2f707

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -44,7 +44,7 @@ query = st.text_input('Enter a query to get started:', value=st.session_state.qu
44
 
45
  def ask_question(query):
46
  start = time.time()
47
- prediction = pipeline.run(query=query, params={"Retriever": {"top_k": 10}, "Reader": {"top_k": 5}})
48
  st.write('Time taken: %s s' % round(time.time()-start, 2))
49
 
50
  results = []
@@ -89,11 +89,12 @@ if st.session_state.results:
89
  answer, context = result["answer"], result["context"]
90
  start_idx = context.find(answer)
91
  end_idx = start_idx + len(answer)
 
92
  st.write(
93
- markdown(context[:start_idx] + str(annotation(body=answer, label="RELEVANT", background="#964448", color='#ffffff')) + context[end_idx:]),
94
  unsafe_allow_html=True,
95
  )
96
- st.markdown(f"**Title:** [{result['title']}]({result['link']})\n**Relevance:** {result['score']}")
97
  else:
98
  st.info(
99
  "πŸ€”    Haystack is unsure whether any of the documents contain an answer to your question. Try to reformulate it!"
 
44
 
45
  def ask_question(query):
46
  start = time.time()
47
+ prediction = pipeline.run(query=query, params={"Retriever": {"top_k": 6}, "Reader": {"top_k": 3}})
48
  st.write('Time taken: %s s' % round(time.time()-start, 2))
49
 
50
  results = []
 
89
  answer, context = result["answer"], result["context"]
90
  start_idx = context.find(answer)
91
  end_idx = start_idx + len(answer)
92
+ st.markdown(f"**Title:** [{result['title']}]({result['link']})")
93
  st.write(
94
+ markdown(context[:start_idx] + str(annotation(body=answer, label="RELEVANT", background="#67a17a", color='#ffffff')) + context[end_idx:]),
95
  unsafe_allow_html=True,
96
  )
97
+ st.markdown(f"**Relevance:** {result['score']}")
98
  else:
99
  st.info(
100
  "πŸ€”    Haystack is unsure whether any of the documents contain an answer to your question. Try to reformulate it!"