zmbfeng commited on
Commit
32d373f
1 Parent(s): 6a3ef3b

move single sentence query to bottomm and optional

Browse files
Files changed (1) hide show
  1. app.py +19 -13
app.py CHANGED
@@ -194,12 +194,8 @@ uploaded_pdf_file = st.file_uploader("Upload a PDF file",
194
  st.markdown(
195
  f'<a href="https://ikmtechnology.github.io/ikmtechnology/Sample_Master_Sample_Life_Insurance_Policy.pdf" target="_blank">Sample Master PDF download and then upload to above</a>',
196
  unsafe_allow_html=True)
197
- st.markdown(
198
- "sample queries to invoke contradiction: <br/> A Member shall be deemed inactive at Work if he or she is capable and available to perform all of his or her regular responsibilities.",
199
- unsafe_allow_html=True)
200
- st.markdown(
201
- f'<a href="https://ikmtechnology.github.io/ikmtechnology/Sample_Secondary.txt" target="_blank">Sample Secondary txt download and then upload to above</a>',
202
- unsafe_allow_html=True)
203
  if uploaded_pdf_file is not None:
204
  if is_new_file_upload(uploaded_pdf_file):
205
  print("is new file uploaded")
@@ -317,15 +313,12 @@ def find_sentences_scores(paragraph_sentence_encodings, query_encoding, query_pl
317
 
318
 
319
  if 'paragraph_sentence_encodings' in st.session_state:
320
- query = st.text_input("Enter your query")
321
- if query:
322
- if 'prev_query' not in st.session_state or st.session_state.prev_query != query:
323
- # if True:
324
- st.session_state.prev_query = query
325
- st.session_state.premise = query
326
- contradiction_detection_for_sentence(query, 1)
327
 
328
  uploaded_text_file = st.file_uploader("Choose a .txt file", type="txt")
 
 
 
329
  if uploaded_text_file is not None:
330
  if is_new_txt_file_upload(uploaded_text_file):
331
  #if True:
@@ -356,3 +349,16 @@ if 'paragraph_sentence_encodings' in st.session_state:
356
  # A Member will be considered as inactive at Work if he or she is able and available for active performance of all of his or her regular duties
357
  # A Member shall be deemed inactive at Work if he or she is capable and available to perform all of his or her regular responsibilities.
358
  # st.write("Modified Paragraph: ", paragraph['modified_text'])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  st.markdown(
195
  f'<a href="https://ikmtechnology.github.io/ikmtechnology/Sample_Master_Sample_Life_Insurance_Policy.pdf" target="_blank">Sample Master PDF download and then upload to above</a>',
196
  unsafe_allow_html=True)
197
+
198
+
 
 
 
 
199
  if uploaded_pdf_file is not None:
200
  if is_new_file_upload(uploaded_pdf_file):
201
  print("is new file uploaded")
 
313
 
314
 
315
  if 'paragraph_sentence_encodings' in st.session_state:
316
+
 
 
 
 
 
 
317
 
318
  uploaded_text_file = st.file_uploader("Choose a .txt file", type="txt")
319
+ st.markdown(
320
+ f'<a href="https://ikmtechnology.github.io/ikmtechnology/Sample_Secondary.txt" target="_blank">Sample Secondary txt download and then upload to above</a>',
321
+ unsafe_allow_html=True)
322
  if uploaded_text_file is not None:
323
  if is_new_txt_file_upload(uploaded_text_file):
324
  #if True:
 
349
  # A Member will be considered as inactive at Work if he or she is able and available for active performance of all of his or her regular duties
350
  # A Member shall be deemed inactive at Work if he or she is capable and available to perform all of his or her regular responsibilities.
351
  # st.write("Modified Paragraph: ", paragraph['modified_text'])
352
+ toggle_single_sentence_input = st.checkbox("optional, if you want to enter a single sentence instead of an entire text file", value=False)
353
+
354
+ if toggle_single_sentence_input:
355
+ st.markdown(
356
+ "sample queries to invoke contradiction: <br/> A Member shall be deemed inactive at Work if he or she is capable and available to perform all of his or her regular responsibilities.",
357
+ unsafe_allow_html=True)
358
+ query = st.text_input("Enter your query")
359
+ if query:
360
+ if 'prev_query' not in st.session_state or st.session_state.prev_query != query:
361
+ # if True:
362
+ st.session_state.prev_query = query
363
+ st.session_state.premise = query
364
+ contradiction_detection_for_sentence(query, 1)