mtyrrell commited on
Commit
ab8363f
1 Parent(s): 6978666

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -12
app.py CHANGED
@@ -37,7 +37,7 @@ pinecone_key = os.environ["PINECONE_API_KEY"]
37
  # )
38
 
39
 
40
- @st.cache(allow_output_mutation=True)
41
  def get_document_store():
42
  # Assuming you're using Elasticsearch as a document store
43
  doc_file_name="cpv_full_southern_africa"
@@ -46,20 +46,27 @@ def get_document_store():
46
  index=doc_file_name)
47
  return document_store
48
 
49
- @st.cache(allow_output_mutation=True)
50
- def get_retriever(document_store):
51
- # Initialize the Pinecone retriever configuration here
52
- retriever = EmbeddingRetriever(
53
- document_store=document_store,
54
- embedding_model="sentence-transformers/multi-qa-mpnet-base-dot-v1",
55
- model_format="sentence_transformers",
56
- progress_bar=False,
57
- )
58
- return retriever
59
 
60
  # Get (or initialize and get) the document store and retriever
61
  document_store = get_document_store()
62
- retriever = get_retriever(document_store)
 
 
 
 
 
 
 
63
 
64
  # template = PromptTemplate(
65
  # prompt="""
 
37
  # )
38
 
39
 
40
+ @st.cache_resource
41
  def get_document_store():
42
  # Assuming you're using Elasticsearch as a document store
43
  doc_file_name="cpv_full_southern_africa"
 
46
  index=doc_file_name)
47
  return document_store
48
 
49
+ # @st.cache(allow_output_mutation=True)
50
+ # def get_retriever(document_store):
51
+ # # Initialize the Pinecone retriever configuration here
52
+ # retriever = EmbeddingRetriever(
53
+ # document_store=document_store,
54
+ # embedding_model="sentence-transformers/multi-qa-mpnet-base-dot-v1",
55
+ # model_format="sentence_transformers",
56
+ # progress_bar=False,
57
+ # )
58
+ # return retriever
59
 
60
  # Get (or initialize and get) the document store and retriever
61
  document_store = get_document_store()
62
+ # retriever = get_retriever(document_store)
63
+
64
+ retriever = EmbeddingRetriever(
65
+ document_store=document_store,
66
+ embedding_model="sentence-transformers/multi-qa-mpnet-base-dot-v1",
67
+ model_format="sentence_transformers",
68
+ progress_bar=False,
69
+ )
70
 
71
  # template = PromptTemplate(
72
  # prompt="""