Register the 'api' subcommand into paddleocr CLI.
(subparsers)
| 28 | |
| 29 | |
| 30 | def register_api_command(subparsers): |
| 31 | """Register the 'api' subcommand into paddleocr CLI.""" |
| 32 | subparser = subparsers.add_parser( |
| 33 | "api", |
| 34 | help="Call PaddleOCR cloud API for OCR or document parsing", |
| 35 | ) |
| 36 | subparser.add_argument( |
| 37 | "--model_type", |
| 38 | type=str, |
| 39 | required=True, |
| 40 | choices=["ocr", "doc_parsing"], |
| 41 | help="Task type: ocr or doc_parsing", |
| 42 | ) |
| 43 | subparser.add_argument( |
| 44 | "--model", |
| 45 | type=str, |
| 46 | default=None, |
| 47 | choices=[m.value for m in Model], |
| 48 | help="Model name.", |
| 49 | ) |
| 50 | subparser.add_argument( |
| 51 | "--file_url", |
| 52 | type=str, |
| 53 | default=None, |
| 54 | help="URL of the file to process", |
| 55 | ) |
| 56 | subparser.add_argument( |
| 57 | "--file_path", |
| 58 | type=str, |
| 59 | default=None, |
| 60 | help="Local file path to process", |
| 61 | ) |
| 62 | subparser.add_argument( |
| 63 | "--base_url", |
| 64 | type=str, |
| 65 | default=None, |
| 66 | help="Base URL of the PaddleOCR API service", |
| 67 | ) |
| 68 | subparser.add_argument( |
| 69 | "--token", |
| 70 | type=str, |
| 71 | default=None, |
| 72 | help="Access token (or set PADDLEOCR_ACCESS_TOKEN env variable)", |
| 73 | ) |
| 74 | subparser.add_argument( |
| 75 | "--client_platform", |
| 76 | type=str, |
| 77 | default=None, |
| 78 | help="Value for the Client-Platform request header", |
| 79 | ) |
| 80 | subparser.add_argument( |
| 81 | "--output", |
| 82 | type=str, |
| 83 | default=None, |
| 84 | help="Output JSON file path (prints to stdout if omitted)", |
| 85 | ) |
| 86 | subparser.add_argument( |
| 87 | "--request_timeout", |
no outgoing calls
no test coverage detected