rename utility to docling-tools

Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
This commit is contained in:
Michele Dolfi 2025-02-05 16:58:03 +01:00
parent 654ce001da
commit 0f830a6ac9
5 changed files with 26 additions and 8 deletions

View File

@ -24,7 +24,8 @@ err_console = Console(stderr=True)
app = typer.Typer( app = typer.Typer(
name="Docling model helper", name="Docling models helper",
no_args_is_help=True,
add_completion=False, add_completion=False,
pretty_exceptions_enable=False, pretty_exceptions_enable=False,
) )
@ -149,9 +150,9 @@ def download(
) )
@app.command(hidden=True) # @app.command(hidden=True)
def other(): # def other():
raise NotImplementedError() # raise NotImplementedError()
click_app = typer.main.get_command(app) click_app = typer.main.get_command(app)

17
docling/cli/tools.py Normal file
View File

@ -0,0 +1,17 @@
import typer
from docling.cli.models_download import app as models_app
app = typer.Typer(
name="Docling helpers",
no_args_is_help=True,
add_completion=False,
pretty_exceptions_enable=False,
)
app.add_typer(models_app, name="models")
click_app = typer.main.get_command(app)
if __name__ == "__main__":
app()

View File

@ -4,7 +4,7 @@ from docling.datamodel.base_models import InputFormat
from docling.datamodel.pipeline_options import EasyOcrOptions, PdfPipelineOptions from docling.datamodel.pipeline_options import EasyOcrOptions, PdfPipelineOptions
from docling.document_converter import DocumentConverter, PdfFormatOption from docling.document_converter import DocumentConverter, PdfFormatOption
# The location of the local artifacts, e.g. from the `docling-models download` command # The location of the local artifacts, e.g. from the `docling-tools models download` command
artifacts_path = Path("PATH TO MODELS") # <-- fill me artifacts_path = Path("PATH TO MODELS") # <-- fill me
pipeline_options = PdfPipelineOptions(artifacts_path=artifacts_path) pipeline_options = PdfPipelineOptions(artifacts_path=artifacts_path)
pipeline_options.ocr_options = EasyOcrOptions( pipeline_options.ocr_options = EasyOcrOptions(

View File

@ -50,10 +50,10 @@ doc_converter = DocumentConverter(
) )
``` ```
To download all the artifacts needed to run offline, Docling provides the `docling-models download` utility. To download all the artifacts needed to run offline, Docling provides the `docling-tools models download` utility.
```sh ```sh
$ docling-models download $ docling-tools models download
Downloading layout model... Downloading layout model...
Downloading tableformer model... Downloading tableformer model...
Downloading picture classifier model... Downloading picture classifier model...

View File

@ -125,7 +125,7 @@ rapidocr = ["rapidocr-onnxruntime", "onnxruntime"]
[tool.poetry.scripts] [tool.poetry.scripts]
docling = "docling.cli.main:app" docling = "docling.cli.main:app"
docling-models = "docling.cli.models_download:app" docling-tools = "docling.cli.tools:app"
[build-system] [build-system]
requires = ["poetry-core"] requires = ["poetry-core"]