Skip to content

Commit

Permalink
linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JingQunCui committed Dec 1, 2023
1 parent 5cf3066 commit 285538e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions ACMAS/app/ACMAS_Web/ocr.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import fitz, os # PyMuPDF
from .models import UploadedFile, Course
import fitz # PyMuPDF
import os
from datetime import date
from django.conf import settings

from django.core.files.storage import FileSystemStorage
from .models import Course, UploadedFile


"""
OCR File Creation Pipeline:
Expand All @@ -12,7 +13,7 @@
- Store text file on filesystem and database
"""
class OCR:
def extract_text_from_pdf(fType, course, fileName, fileUrl):
def extract_text_from_pdf(self, fType, course, fileName, fileUrl):
# Adding file to filesystem
fs = FileSystemStorage()
removeExt = os.path.splitext(fileName)[0]
Expand Down
3 changes: 2 additions & 1 deletion ACMAS/app/ACMAS_Web/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def uploadFile(self, uni, course, fType, file):
file_url = fs.url(savedFile) # Retrieve the file path
print(f'FILE "{savedFile}" uploaded to "{file_url}"\n')

OCR.extract_text_from_pdf(fType, course, fileName, file_url)
ocrObject = OCR
ocrObject.extract_text_from_pdf(fType, course, fileName, file_url)

# Adding file to database
db_file = UploadedFile(
Expand Down

0 comments on commit 285538e

Please sign in to comment.