bishmoy commited on
Commit
3c305fd
1 Parent(s): 6650ee4

Added info for setting up retriever for the first time

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -14,6 +14,12 @@ generate_kwargs = dict(
14
  )
15
 
16
  RAG = RAGPretrainedModel.from_index("colbert/indexes/arxiv_colbert")
 
 
 
 
 
 
17
 
18
  mark_text = '# 📚 Search Results\n'
19
 
@@ -58,7 +64,7 @@ with gr.Blocks(theme = gr.themes.Soft()) as demo:
58
 
59
  def ask_llm(prompt):
60
  output = client.text_generation(prompt, **generate_kwargs, stream=False, details=False, return_full_text=False)
61
- output = output.lstrip(' \n']) if output.lstrip().startswith('\n') else output
62
  return gr.Textbox(output, visible = True)
63
 
64
  msg.submit(update_with_rag_md, msg, [gr_md, input]).success(ask_llm, input, output_text)
 
14
  )
15
 
16
  RAG = RAGPretrainedModel.from_index("colbert/indexes/arxiv_colbert")
17
+ try:
18
+ gr.Info("Setting up retriever, please wait...")
19
+ _ = RAG.search("what is Mistral?", k = 1)
20
+ gr.Info("Retriever working successfully!")
21
+ except:
22
+ gr.Warning("Retriever not working!")
23
 
24
  mark_text = '# 📚 Search Results\n'
25
 
 
64
 
65
  def ask_llm(prompt):
66
  output = client.text_generation(prompt, **generate_kwargs, stream=False, details=False, return_full_text=False)
67
+ output = output.lstrip(' \n') if output.lstrip().startswith('\n') else output
68
  return gr.Textbox(output, visible = True)
69
 
70
  msg.submit(update_with_rag_md, msg, [gr_md, input]).success(ask_llm, input, output_text)