Abhilashvj commited on
Commit
946061f
1 Parent(s): ea5130a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -37
app.py CHANGED
@@ -68,29 +68,7 @@ index = pinecone.Index(index_name)
68
 
69
  FILE_UPLOAD_PATH= "./data/uploads/"
70
  os.makedirs(FILE_UPLOAD_PATH, exist_ok=True)
71
- # @st.cache
72
- def create_doc_store():
73
- document_store = PineconeDocumentStore(
74
- api_key= st.secrets["pinecone_apikey"],
75
- index=index_name,
76
- similarity="cosine",
77
- embedding_dim=768,
78
- metadata_config={
79
- 'indexed': ['filename']
80
- }
81
- )
82
- return document_store
83
-
84
- # @st.cache
85
- # def create_pipe(document_store):
86
- # retriever = EmbeddingRetriever(
87
- # document_store=document_store,
88
- # embedding_model="sentence-transformers/multi-qa-mpnet-base-dot-v1",
89
- # model_format="sentence_transformers",
90
- # )
91
- # reader = FARMReader(model_name_or_path="deepset/roberta-base-squad2", use_gpu=False)
92
- # pipe = ExtractiveQAPipeline(reader, retriever)
93
- # return pipe
94
  limit = 3750
95
 
96
  def retrieve(query):
@@ -154,20 +132,6 @@ def query(pipe, question, top_k_reader, top_k_retriever):
154
  query_with_contexts, contexts = retrieve(question)
155
  return complete(query_with_contexts), contexts
156
 
157
- document_store = create_doc_store()
158
- # pipe = create_pipe(document_store)
159
- retriever_model = "sentence-transformers/multi-qa-mpnet-base-dot-v1"
160
- retriever = EmbeddingRetriever(
161
- document_store=document_store,
162
- embedding_model=retriever_model,
163
- model_format="sentence_transformers",
164
- )
165
- # load the retriever model from huggingface model hub
166
- # sentence_encoder = SentenceTransformer(retriever_model)
167
-
168
- # reader = FARMReader(model_name_or_path="deepset/roberta-base-squad2", use_gpu=False)
169
- # pipe = ExtractiveQAPipeline(reader, retriever)
170
- # now query text-davinci-003 WITHOUT context
171
 
172
  indexing_pipeline_with_classification = Pipeline()
173
  indexing_pipeline_with_classification.add_node(
 
68
 
69
  FILE_UPLOAD_PATH= "./data/uploads/"
70
  os.makedirs(FILE_UPLOAD_PATH, exist_ok=True)
71
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  limit = 3750
73
 
74
  def retrieve(query):
 
132
  query_with_contexts, contexts = retrieve(question)
133
  return complete(query_with_contexts), contexts
134
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
 
136
  indexing_pipeline_with_classification = Pipeline()
137
  indexing_pipeline_with_classification.add_node(