Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -26,10 +26,10 @@ def answer_question(model_name, file, question, status):
|
|
26 |
if file is not None:
|
27 |
file_name = file.name
|
28 |
if file_name.endswith(".pdf"):
|
29 |
-
pdf_reader = PyPDF2.
|
30 |
context = ""
|
31 |
-
for page_num in range(pdf_reader.
|
32 |
-
context += pdf_reader.
|
33 |
elif file_name.endswith(".md"):
|
34 |
context = file.read().decode('utf-8')
|
35 |
context = markdown.markdown(context)
|
@@ -89,4 +89,4 @@ with gr.Blocks() as interface:
|
|
89 |
)
|
90 |
|
91 |
if __name__ == "__main__":
|
92 |
-
interface.launch()
|
|
|
26 |
if file is not None:
|
27 |
file_name = file.name
|
28 |
if file_name.endswith(".pdf"):
|
29 |
+
pdf_reader = PyPDF2.PdfReader(file)
|
30 |
context = ""
|
31 |
+
for page_num in range(len(pdf_reader.pages)):
|
32 |
+
context += pdf_reader.pages[page_num].extract_text()
|
33 |
elif file_name.endswith(".md"):
|
34 |
context = file.read().decode('utf-8')
|
35 |
context = markdown.markdown(context)
|
|
|
89 |
)
|
90 |
|
91 |
if __name__ == "__main__":
|
92 |
+
interface.launch(share=True)
|