Skip to content

Commit

Permalink
Add delay to get suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-piles committed Sep 19, 2024
1 parent da6cc11 commit ed39f26
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ RUN pip --default-timeout=1000 install -r requirements.txt

COPY ./data ./data
COPY app.py app.py
COPY test.xml test.xml
COPY worker_metadata.py worker_metadata.py
COPY worker_paragraphs.py worker_paragraphs.py
COPY worker_translations.py worker_translations.py
Expand Down
4 changes: 3 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys
from os.path import exists
from pathlib import Path
from time import sleep

from fastapi import FastAPI, UploadFile, File
from starlette.responses import PlainTextResponse
Expand Down Expand Up @@ -92,7 +93,7 @@ async def get_suggestions(tenant: str, extractor_id: str):
segment_text="2023" if not values else ' '.join([option["label"] for option in values]),
page_number=1,
segments_boxes=[SegmentBox(left=0, top=0, width=250, height=250, page_number=1)],
).dict()
).model_dump()
)

if exists(data_path):
Expand All @@ -101,4 +102,5 @@ async def get_suggestions(tenant: str, extractor_id: str):
if exists(params_path):
os.remove(params_path)

sleep(5)
return json.dumps(suggestions_list)

0 comments on commit ed39f26

Please sign in to comment.