lekkalar commited on
Commit
a4ce5ba
1 Parent(s): aaf3891

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -15
app.py CHANGED
@@ -42,8 +42,7 @@ def load_pdf_and_generate_embeddings(pdf_doc, open_ai_key):
42
 
43
 
44
  def answer_predefined_questions(document_type):
45
- queryList=[]
46
- fieldList=[]
47
  if document_type == "Deed of Trust":
48
  #Create a list of questions around the relevant fields of a Deed of Trust(DOT) document
49
  query0 = "what is the Lender's Name?"
@@ -70,12 +69,9 @@ def answer_predefined_questions(document_type):
70
  field10 = "Property County"
71
  query11 = "what is the Electronically recorded date"
72
  field11 = "Electronic Recording Date"
73
- queryListForDOT = [query0, query1, query2, query3, query4, query5, query6, query7, query8, query9, query10, query11]
74
- fieldListForDOT = [field0, field1, field2, field3, field4, field5, field6, field7, field8, field9, field10, field11]
75
- for query in queryListForDOT:
76
- queryList.append(query)
77
- for field in fieldListForDOT:
78
- fieldList.append(field)
79
 
80
  elif document_type == "Transmittal Summary":
81
  #Create a list of questions around the relevant fields of a TRANSMITTAL SUMMARY document
@@ -103,16 +99,14 @@ def answer_predefined_questions(document_type):
103
  fieldA10 = "Seller"
104
  queryA11 = "Document signed date?"
105
  fieldA11 = "Singed Date"
106
- queryListForTransmittalSummary = [queryA0, queryA1, queryA2, queryA3, queryA4, queryA5, queryA6, queryA7, queryA8, queryA9, queryA10, queryA11]
107
- fieldListForTransmittalSummary = [fieldA0, fieldA1, fieldA2, fieldA3, fieldA4, fieldA5, fieldA6, fieldA7, fieldA8, fieldA9, fieldA10, fieldA11]
108
- for query in queryListForTransmittalSummary:
109
- queryList.append(query)
110
- for field in fieldListForTransmittalSummary:
111
- fieldList.append(field)
112
 
113
  i = 0
114
  while i < len(queryList):
115
- question = questionList[i]
116
  field = fieldList[i]
117
  response += "Field Name:", field, "; Question sent to gpt-4: ", question, "; Response from gpt-4:",pdf_qa.run(question)
118
  return response
 
42
 
43
 
44
  def answer_predefined_questions(document_type):
45
+
 
46
  if document_type == "Deed of Trust":
47
  #Create a list of questions around the relevant fields of a Deed of Trust(DOT) document
48
  query0 = "what is the Lender's Name?"
 
69
  field10 = "Property County"
70
  query11 = "what is the Electronically recorded date"
71
  field11 = "Electronic Recording Date"
72
+ queryList = [query0, query1, query2, query3, query4, query5, query6, query7, query8, query9, query10, query11]
73
+ fieldList= [field0, field1, field2, field3, field4, field5, field6, field7, field8, field9, field10, field11]
74
+
 
 
 
75
 
76
  elif document_type == "Transmittal Summary":
77
  #Create a list of questions around the relevant fields of a TRANSMITTAL SUMMARY document
 
99
  fieldA10 = "Seller"
100
  queryA11 = "Document signed date?"
101
  fieldA11 = "Singed Date"
102
+ queryList = [queryA0, queryA1, queryA2, queryA3, queryA4, queryA5, queryA6, queryA7, queryA8, queryA9, queryA10, queryA11]
103
+ fieldList = [fieldA0, fieldA1, fieldA2, fieldA3, fieldA4, fieldA5, fieldA6, fieldA7, fieldA8, fieldA9, fieldA10, fieldA11]
104
+
105
+
 
 
106
 
107
  i = 0
108
  while i < len(queryList):
109
+ question = queryList[i]
110
  field = fieldList[i]
111
  response += "Field Name:", field, "; Question sent to gpt-4: ", question, "; Response from gpt-4:",pdf_qa.run(question)
112
  return response