diff --git a/docker/Dockerfile b/Dockerfile
similarity index 79%
rename from docker/Dockerfile
rename to Dockerfile
index 43e4be14..a191bd42 100644
--- a/docker/Dockerfile
+++ b/Dockerfile
@@ -1,11 +1,11 @@
ARG REPOSITORY="docker.io"
-FROM dedocproject/baseimg
+FROM dedocproject/dedoc_p3.9_base:version_2023_08_28
ENV PYTHONPATH "${PYTHONPATH}:/dedoc_root"
ENV RESOURCES_PATH "/dedoc_root/resources"
ADD requirements.txt .
-RUN pip3 install -r requirements.txt
+RUN pip3 install --no-cache-dir -r requirements.txt
RUN mkdir /dedoc_root
ADD dedoc /dedoc_root/dedoc
@@ -17,4 +17,4 @@ RUN python3 /dedoc_root/dedoc/download_models.py
ADD tests /dedoc_root/tests
ADD resources /dedoc_root/resources
-CMD ["python3", "/dedoc_root/dedoc/main.py", "-c", "/dedoc_root/dedoc/config.py"]
\ No newline at end of file
+CMD ["python3", "/dedoc_root/dedoc/main.py", "-c", "/dedoc_root/dedoc/config.py"]
diff --git a/dedoc/api/api_utils.py b/dedoc/api/api_utils.py
index bd765535..a772c95b 100644
--- a/dedoc/api/api_utils.py
+++ b/dedoc/api/api_utils.py
@@ -219,3 +219,9 @@ def __table2html(table: Table, table2id: Dict[str, int]) -> str:
text += "\n"
text += "\n"
return text
+
+
+def json2txt(paragraph: TreeNode) -> str:
+ subparagraphs_text = "\n".join([json2txt(subparagraph) for subparagraph in paragraph.subparagraphs])
+ text = f"{paragraph.text}\n{subparagraphs_text}"
+ return text
diff --git a/dedoc/api/dedoc_api.py b/dedoc/api/dedoc_api.py
index 370a3cc1..7e295c7a 100644
--- a/dedoc/api/dedoc_api.py
+++ b/dedoc/api/dedoc_api.py
@@ -10,7 +10,7 @@
import dedoc
from dedoc.api.api_args import QueryParameters
-from dedoc.api.api_utils import json2collapsed_tree, json2html, json2tree
+from dedoc.api.api_utils import json2collapsed_tree, json2html, json2tree, json2txt
from dedoc.common.exceptions.dedoc_error import DedocError
from dedoc.common.exceptions.missing_file_error import MissingFileError
from dedoc.config import get_config
@@ -76,6 +76,9 @@ async def upload(file: UploadFile = File(...), query_params: QueryParameters = D
if return_format == "html":
html_content = json2html(text="", paragraph=document_tree.content.structure, tables=document_tree.content.tables, tabs=0)
return HTMLResponse(content=html_content, status_code=200)
+ elif return_format == "plain_text":
+ txt_content = json2txt(paragraph=document_tree.content.structure)
+ return PlainTextResponse(content=txt_content, status_code=200)
elif return_format == "tree":
html_content = json2tree(paragraph=document_tree.content.structure)
return HTMLResponse(content=html_content, status_code=200)
diff --git a/dedoc/api/static/html_eng/form_input.html b/dedoc/api/static/html_eng/form_input.html
index cdb39042..e8ab3081 100644
--- a/dedoc/api/static/html_eng/form_input.html
+++ b/dedoc/api/static/html_eng/form_input.html
@@ -32,6 +32,7 @@
Structure Document Recognition