Mary12 commited on
Commit
1b2b327
·
1 Parent(s): 5c4e0ae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -70,9 +70,11 @@ def qa_result(context, question, file, pipe = pipe):
70
  elif extension == allowed_types[1]:
71
  context = extract_text_from_txt(file.name)
72
  else:
73
- context = extract_text_from_doc(file.name)
74
  result = pipe(question=question, context=context)
75
  answered = result['answer']
 
 
76
  # text = remove_references(answered)
77
 
78
  if file is None and len(context) == 0 and len(question) == 0:
@@ -88,8 +90,8 @@ def qa_result(context, question, file, pipe = pipe):
88
  else:
89
  result = pipe(question=question, context=context)
90
  answered = result['answer']
 
91
 
92
- text = remove_references(answered)
93
  text = text.replace('(', '', 1)
94
  text = text.replace(',', '', len(text)-1)
95
 
 
70
  elif extension == allowed_types[1]:
71
  context = extract_text_from_txt(file.name)
72
  else:
73
+ context = extract_text_from_pdf(file.name)
74
  result = pipe(question=question, context=context)
75
  answered = result['answer']
76
+ text = remove_references(answered)
77
+
78
  # text = remove_references(answered)
79
 
80
  if file is None and len(context) == 0 and len(question) == 0:
 
90
  else:
91
  result = pipe(question=question, context=context)
92
  answered = result['answer']
93
+ text = remove_references(answered)
94
 
 
95
  text = text.replace('(', '', 1)
96
  text = text.replace(',', '', len(text)-1)
97