Sasidhar commited on
Commit
134ae6e
·
1 Parent(s): eb63d9b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -11
app.py CHANGED
@@ -261,27 +261,30 @@ elif selected_menu == "Extract Entities":
261
  st.markdown("""---""")
262
 
263
  elif selected_menu == "Detected Barriers":
264
- st.subheader('Barriers Detected')
265
  barriers_to_detect = {"Chronic Pain":"Is the patint experiencing chronic pain?",
266
  "Mental Health Issues":"Does he have any mental issues?",
267
  "Prior History":"What is prior medical history?",
268
  "Smoking":"Does he smoke?",
269
  "Drinking":"Does he drink?",
270
  "Comorbidities":"Does he have any comorbidities?"}
271
-
272
- for barrier,question_text in barriers_to_detect.items():
273
 
274
- context = get_text_from_ocr_engine()
275
- if question_text:
276
- result = pipeline_qa(question=question_text, context=context)
277
- st.subheader(barrier)
278
- st.text(result['answer'])
 
 
 
279
 
280
  elif selected_menu == "Get Answers":
281
  st.subheader('Question')
282
  question_text = st.text_input("Type your question")
283
  context = get_text_from_ocr_engine()
 
284
  if question_text:
285
- result = pipeline_qa(question=question_text, context=context)
286
- st.subheader('Answer')
287
- st.text(result['answer'])
 
 
261
  st.markdown("""---""")
262
 
263
  elif selected_menu == "Detected Barriers":
264
+ #st.subheader('Barriers Detected')
265
  barriers_to_detect = {"Chronic Pain":"Is the patint experiencing chronic pain?",
266
  "Mental Health Issues":"Does he have any mental issues?",
267
  "Prior History":"What is prior medical history?",
268
  "Smoking":"Does he smoke?",
269
  "Drinking":"Does he drink?",
270
  "Comorbidities":"Does he have any comorbidities?"}
 
 
271
 
272
+ with st.spinner("Detecting Barriers..."):
273
+ for barrier,question_text in barriers_to_detect.items():
274
+
275
+ context = get_text_from_ocr_engine()
276
+ if question_text:
277
+ result = pipeline_qa(question=question_text, context=context)
278
+ st.subheader(barrier)
279
+ st.text(result['answer'])
280
 
281
  elif selected_menu == "Get Answers":
282
  st.subheader('Question')
283
  question_text = st.text_input("Type your question")
284
  context = get_text_from_ocr_engine()
285
+
286
  if question_text:
287
+ with st.spinner("Finding Answer(s)..."):
288
+ result = pipeline_qa(question=question_text, context=context)
289
+ st.subheader('Answer')
290
+ st.text(result['answer'])