Skip to content

Commit

Permalink
Make TOC endpoint async
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-piles committed Apr 29, 2024
1 parent 215c549 commit ff8744f
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 26 deletions.
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
install:
. venv/bin/activate; pip install -Ur requirements.txt
. .venv/bin/activate; pip install -Ur requirements.txt

activate:
. venv/bin/activate
. .venv/bin/activate

install_venv:
python3 -m venv venv
. venv/bin/activate; python -m pip install --upgrade pip
. venv/bin/activate; python -m pip install -r dev-requirements.txt
python3 -m venv .venv
. .venv/bin/activate; python -m pip install --upgrade pip
. .venv/bin/activate; python -m pip install -r dev-requirements.txt

formatter:
. venv/bin/activate; command black --line-length 125 .
. .venv/bin/activate; command black --line-length 125 .

check_format:
. venv/bin/activate; command black --line-length 125 . --check
. .venv/bin/activate; command black --line-length 125 . --check

test:
. venv/bin/activate; command cd src; command pytest
. .venv/bin/activate; command cd src; command pytest

remove_docker_containers:
docker compose ps -q | xargs docker rm
Expand All @@ -43,4 +43,4 @@ stop:
docker compose stop

delete_queues:
. venv/bin/activate; python scripts/delete_queues.py
. .venv/bin/activate; python scripts/delete_queues.py
4 changes: 2 additions & 2 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-r requirements.txt
pytest==7.4.2
black==23.9.1
pytest==8.2.0
black==24.4.2
mongomock==4.1.2
7 changes: 0 additions & 7 deletions foo.py

This file was deleted.

10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
fastapi==0.110.1
fastapi==0.110.2
graypy==2.1.0
python-multipart==0.0.9
uvicorn==0.29.0
gunicorn==21.2.0
gunicorn==22.0.0
nltk==3.8.1
PyYAML==6.0.1
requests==2.31.0
pymongo==4.6.3
pymongo==4.7.0
PyRSMQ==0.5.0
redis==5.0.3
redis==5.0.4
httpx==0.27.0
sentry-sdk==1.44.0
sentry-sdk==2.0.1
git+https://github.com/huridocs/pdf-tokens-type-labeler@1c12c368887372164ab4981c3277a49e9dc43b9a
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
name=PROJECT_NAME,
packages=["paragraph_extraction_trainer"],
package_dir={"": "src"},
version="0.32",
version="0.33",
url="https://github.com/huridocs/pdf_paragraphs_extraction",
author="HURIDOCS",
description="Service for extracting paragraphs from PDFs.",
Expand Down
2 changes: 1 addition & 1 deletion src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ async def get_xml(tenant: str, pdf_file_name: str):


@app.post("/get_toc")
def get_toc(file: UploadFile = File(...)):
async def get_toc(file: UploadFile = File(...)):
filename = "No file name!"
try:
filename = file.filename
Expand Down
2 changes: 1 addition & 1 deletion src/toc/TitleFeatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def get_features_toc(self) -> np.array:
1 if self.italics else 0,
self.first_characters_type,
self.first_characters_special_markers_count,
self.bullet_points_type
self.bullet_points_type,
# self.text_centered,
# self.is_left,
# self.indentation
Expand Down

0 comments on commit ff8744f

Please sign in to comment.