ppsingh commited on
Commit
e5fddb6
1 Parent(s): 72821a1

add reader

Browse files
Files changed (2) hide show
  1. appStore/reader.py +2 -2
  2. utils/reader_qa.py +10 -3
appStore/reader.py CHANGED
@@ -37,9 +37,9 @@ def app():
37
  else:
38
  warning_msg = ""
39
 
40
- reader_highlight(haystack_doc=df,
41
  threshold= params['threshold'])
42
- # st.session_state.key1 = df
43
 
44
 
45
 
 
37
  else:
38
  warning_msg = ""
39
 
40
+ df = reader_highlight(haystack_doc=df,
41
  threshold= params['threshold'])
42
+ st.session_state.key1 = df
43
 
44
 
45
 
utils/reader_qa.py CHANGED
@@ -82,10 +82,17 @@ def reader_highlight(haystack_doc:pd.DataFrame,
82
  for text in list(df1.text):
83
  predictions.append(reader_model(question = ques_, context = text))
84
 
85
- st.write(predictions)
86
  # # getting the sector label and scores
87
- # list_ = []
88
- # for i in range(len(predictions)):
 
 
 
 
 
 
 
 
89
 
90
  # temp = predictions[i]
91
  # placeholder = {}
 
82
  for text in list(df1.text):
83
  predictions.append(reader_model(question = ques_, context = text))
84
 
 
85
  # # getting the sector label and scores
86
+ list_ = []
87
+ for i in range(len(predictions)):
88
+ list_.append(predictions['answer'])
89
+ df1['Extracted Text'] = list_
90
+
91
+ df = pd.concat([df,df1])
92
+ df = df.reset_index(drop =True)
93
+ df.index += 1
94
+
95
+ return df
96
 
97
  # temp = predictions[i]
98
  # placeholder = {}