Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -77,7 +77,7 @@ async def pdf_question_answering(
|
|
77 |
images = []
|
78 |
|
79 |
# Use PyMuPDF to process the PDF and convert each page to an image
|
80 |
-
pdf_document = fitz.
|
81 |
|
82 |
for page_num in range(pdf_document.page_count):
|
83 |
page = pdf_document.load_page(page_num)
|
@@ -108,7 +108,7 @@ async def pdf_question_answering(
|
|
108 |
|
109 |
except Exception as e:
|
110 |
return JSONResponse(content=f"Error processing PDF file: {str(e)}", status_code=500)
|
111 |
-
|
112 |
# Set up CORS middleware
|
113 |
origins = ["*"] # or specify your list of allowed origins
|
114 |
app.add_middleware(
|
|
|
77 |
images = []
|
78 |
|
79 |
# Use PyMuPDF to process the PDF and convert each page to an image
|
80 |
+
pdf_document = fitz.open_memo(contents, "pdf")
|
81 |
|
82 |
for page_num in range(pdf_document.page_count):
|
83 |
page = pdf_document.load_page(page_num)
|
|
|
108 |
|
109 |
except Exception as e:
|
110 |
return JSONResponse(content=f"Error processing PDF file: {str(e)}", status_code=500)
|
111 |
+
|
112 |
# Set up CORS middleware
|
113 |
origins = ["*"] # or specify your list of allowed origins
|
114 |
app.add_middleware(
|