MJobe commited on
Commit
3302f65
1 Parent(s): 02f313e

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +2 -2
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.open_stream(contents, "pdf")
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(