Update app.py
Browse files
app.py
CHANGED
@@ -8,15 +8,18 @@ pipe = pipeline("question-answering", model='distilbert-base-uncased-distilled-s
|
|
8 |
def predict(file_obj, question):
|
9 |
docText = ""
|
10 |
reader = PdfReader(file_obj.name)
|
|
|
11 |
|
12 |
for page in reader.pages:
|
13 |
txt = page.extract_text()
|
14 |
-
docText += " "
|
15 |
|
16 |
qaInput = {
|
17 |
'question': question,
|
18 |
'context': docText
|
19 |
-
}
|
|
|
|
|
20 |
|
21 |
return pipe(qaInput)
|
22 |
|
|
|
8 |
def predict(file_obj, question):
|
9 |
docText = ""
|
10 |
reader = PdfReader(file_obj.name)
|
11 |
+
print(len(reader.pages))
|
12 |
|
13 |
for page in reader.pages:
|
14 |
txt = page.extract_text()
|
15 |
+
docText += f" {txt}")
|
16 |
|
17 |
qaInput = {
|
18 |
'question': question,
|
19 |
'context': docText
|
20 |
+
}
|
21 |
+
|
22 |
+
print(docText[-10:-1])
|
23 |
|
24 |
return pipe(qaInput)
|
25 |
|