Spaces:
Sleeping
Sleeping
xavierbarbier
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -52,9 +52,20 @@ p = pipeline(
|
|
52 |
)
|
53 |
|
54 |
def qa(question: str, doc: str) -> str:
|
55 |
-
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
|
60 |
demo = gr.Interface(
|
|
|
52 |
)
|
53 |
|
54 |
def qa(question: str, doc: str) -> str:
|
55 |
+
|
56 |
+
reader = PdfReader(doc)
|
57 |
+
|
58 |
+
text = []
|
59 |
+
for p in np.arange(0, len(reader.pages), 1):
|
60 |
+
page = reader.pages[int(p)]
|
61 |
+
|
62 |
+
# extracting text from page
|
63 |
+
text.append(page.extract_text())
|
64 |
+
|
65 |
+
text = ' '.join(text)
|
66 |
+
|
67 |
+
|
68 |
+
return text
|
69 |
|
70 |
|
71 |
demo = gr.Interface(
|