diff --git a/formfyxer/docx_wrangling.py b/formfyxer/docx_wrangling.py index 4c80c46..b4b0368 100644 --- a/formfyxer/docx_wrangling.py +++ b/formfyxer/docx_wrangling.py @@ -51,8 +51,8 @@ def add_run_after(run, text): def update_docx( - document: Union[docx.Document, str], modified_runs: List[Tuple[int, int, str, int]] -) -> docx.Document: + document: Union[docx.document.Document, str], modified_runs: List[Tuple[int, int, str, int]] +) -> docx.document.Document: """Update the document with the modified runs. Note: OpenAI is probabilistic, so the modified run indices may not be correct. @@ -416,7 +416,7 @@ def get_modified_docx_runs( guesses = json.loads(response.choices[0].message.content)["results"] return guesses -def make_docx_plain_language(docx_path: str) -> docx.Document: +def make_docx_plain_language(docx_path: str) -> docx.document.Document: """ Convert a DOCX file to plain language with the help of OpenAI. """ @@ -443,7 +443,7 @@ def make_docx_plain_language(docx_path: str) -> docx.Document: ) return update_docx(docx.Document(docx_path), guesses) -def modify_docx_with_openai_guesses(docx_path: str) -> docx.Document: +def modify_docx_with_openai_guesses(docx_path: str) -> docx.document.Document: """Uses OpenAI to guess the variable names for a document and then modifies the document with the guesses. Args: diff --git a/formfyxer/pdf_wrangling.py b/formfyxer/pdf_wrangling.py index 0a5a509..8ce7f32 100644 --- a/formfyxer/pdf_wrangling.py +++ b/formfyxer/pdf_wrangling.py @@ -1152,8 +1152,8 @@ def get_possible_radios(img: Union[str, BinaryIO, cv2.Mat]): maxRadius=50, ) if circles is not None: - circles = np.uint16(np.around(circles)) - for i in circles[0, :]: + rounded_circles = np.around(circles) + for i in rounded_circles[0, :]: center = (i[0], i[1]) # circle center cv2.circle(img_mat, center, 1, (0, 100, 100), 3) diff --git a/setup.py b/setup.py index f13a7e8..271eec5 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ def run(self): license='MIT', packages=['formfyxer'], install_requires=['spacy', 'pdfminer.six', 'pandas', 'pikepdf', - 'textstat', 'requests', 'numpy', 'scikit-learn==1.2.2', 'networkx', 'joblib', + 'textstat', 'requests', 'numpy<2.0.0', 'scikit-learn==1.2.2', 'networkx', 'joblib', 'nltk', 'boxdetect', 'pdf2image', 'reportlab>=3.6.13', 'pdfminer.six', 'opencv-python', 'ocrmypdf', 'eyecite', 'passivepy>=0.2.16', 'sigfig', 'typer>=0.4.1,<0.5.0', # typer pre 0.4.1 was broken by click 8.1.0: https://github.com/explosion/spaCy/issues/10564