From 05084712c491a8484a94ce9408334583e185708b Mon Sep 17 00:00:00 2001 From: Vijay Soni Date: Mon, 23 Dec 2024 01:07:13 +0530 Subject: [PATCH] --- src/markitdown/__main__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/markitdown/__main__.py b/src/markitdown/__main__.py index b6cf963..ea32f60 100644 --- a/src/markitdown/__main__.py +++ b/src/markitdown/__main__.py @@ -6,6 +6,7 @@ from textwrap import dedent from .__about__ import __version__ from ._markitdown import MarkItDown, DocumentConverterResult +import uvicorn def main(): @@ -57,9 +58,16 @@ def main(): "--output", help="Output file name. If not provided, output is written to stdout.", ) + parser.add_argument( + "--api", + action="store_true", + help="Start the FastAPI server", + ) args = parser.parse_args() - if args.filename is None: + if args.api: + uvicorn.run("src.markitdown.api:app", host="0.0.0.0", port=8000) + elif args.filename is None: markitdown = MarkItDown() result = markitdown.convert_stream(sys.stdin.buffer) _handle_output(args, result)