Commit
·
62d5cd1
1
Parent(s):
e4c3a1e
Update app.py
Browse files
app.py
CHANGED
@@ -167,8 +167,10 @@ class ChemicalIdentifier:
|
|
167 |
file_paths = [single_file_path.name for single_file_path in file_paths]
|
168 |
return file_paths
|
169 |
|
170 |
-
def get_chemicals_for_file(self,state
|
171 |
|
|
|
|
|
172 |
# Set the question for which we want to find the answer
|
173 |
question = "Identify the Chemical Capabilities Only"
|
174 |
|
@@ -217,10 +219,10 @@ class ChemicalIdentifier:
|
|
217 |
|
218 |
# Create a knowledge base from the loaded documents using the create_knowledge_base() method
|
219 |
knowledge_base = self.create_knowledge_base(docs)
|
220 |
-
|
221 |
pdf_name = os.path.basename(file_obj)
|
222 |
global results
|
223 |
-
final_ans = self.get_chemicals_for_file(state
|
224 |
results += pdf_name+"\n"+final_ans+"\n\n"
|
225 |
|
226 |
# Return a tuple containing the file name and the knowledge base
|
|
|
167 |
file_paths = [single_file_path.name for single_file_path in file_paths]
|
168 |
return file_paths
|
169 |
|
170 |
+
def get_chemicals_for_file(self,state):
|
171 |
|
172 |
+
knowledge_base = state["knowledge_base"]
|
173 |
+
|
174 |
# Set the question for which we want to find the answer
|
175 |
question = "Identify the Chemical Capabilities Only"
|
176 |
|
|
|
219 |
|
220 |
# Create a knowledge base from the loaded documents using the create_knowledge_base() method
|
221 |
knowledge_base = self.create_knowledge_base(docs)
|
222 |
+
state = {"knowledge_base": knowledge_base}
|
223 |
pdf_name = os.path.basename(file_obj)
|
224 |
global results
|
225 |
+
final_ans = self.get_chemicals_for_file(state)
|
226 |
results += pdf_name+"\n"+final_ans+"\n\n"
|
227 |
|
228 |
# Return a tuple containing the file name and the knowledge base
|