openapi: 3.1.0
info:
  title: PaddleOCR
  version: 1.0.0
  description: PaddleOCR
paths:
  /v1/metrics:
    get:
      summary: Metrics
      description: Handler for metrics endpoint.
      operationId: metrics_v1_metrics_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: string
                title: Response Metrics V1 Metrics Get
  /v1/license:
    get:
      summary: License
      description: Handler for license endpoint.
      operationId: license_v1_license_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LicenseEndpointModel'
  /v1/metadata:
    get:
      summary: Metadata
      description: Handler for metadata endpoint.
      operationId: metadata_v1_metadata_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetadataEndpointModel'
  /v1/manifest:
    get:
      summary: Manifest
      description: Handler for the manifest endpoint.
      operationId: manifest_v1_manifest_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManifestEndpointModel'
  /v1/infer:
    post:
      summary: Inference Endpoint
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PaddleOCRRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaddleOCRResponse'
        '503':
          description: Service not ready
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /v1/health/ready:
    get:
      summary: Readiness Endpoint
      responses:
        '200':
          description: Service ready
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HealthReadyResponse'
        '503':
          description: Service not ready
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HealthReadyResponse'
  /v1/health/live:
    get:
      summary: Liveness Endpoint
      responses:
        '200':
          description: Service live
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HealthLiveResponse'
        '503':
          description: Service not live
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HealthLiveResponse'
components:
  schemas:
    LicenseEndpointModel:
      properties:
        name:
          type: string
          title: Name
          description: The name of the license for the NIM container.
        path:
          type: string
          title: Path
          description: The filepath within the container containing the license content.
        sha:
          type: string
          title: Sha
          description: A SHA1 hash of the license contents.
        size:
          type: integer
          title: Size
          description: The number of characters in the license content.
        url:
          type: string
          title: Url
          description: The url where this license is hosted externally.
        type:
          type: string
          enum:
          - file
          const: file
          title: Type
          description: The format of the license content.
        content:
          type: string
          title: Content
          description: The license text.
      type: object
      required:
      - name
      - path
      - sha
      - size
      - url
      - type
      - content
      title: LicenseEndpointModel
      description: A model representing the license response.
    ManifestEndpointModel:
      properties:
        manifest_file:
          type: string
          title: Manifest File
          description: The content of the manifest file describing the required model
            artifacts.
      type: object
      required:
      - manifest_file
      title: ManifestEndpointModel
      description: A model representing the manifest response.
    MetadataEndpointModel:
      properties:
        assetInfo:
          items:
            type: string
          type: array
          title: Assetinfo
          description: A list of required container assets excluding model artifacts
        licenseInfo:
          $ref: '#/components/schemas/LicenseEndpointModel'
          description: The license info.
        modelInfo:
          items:
            $ref: '#/components/schemas/ModelInfo'
          type: array
          title: Modelinfo
          description: A list of models being served by the NIM.
        version:
          type: string
          title: Version
          description: The version of the NIM service.
      type: object
      required:
      - assetInfo
      - licenseInfo
      - modelInfo
      - version
      title: MetadataEndpointModel
      description: A model representing the metadata response.
    ModelInfo:
      properties:
        modelUrl:
          type: string
          title: Modelurl
        shortName:
          type: string
          title: Shortname
      type: object
      required:
      - modelUrl
      - shortName
      title: ModelInfo
      description: A model representing the model response.
    PaddleOCRRequest:
      $defs:
        Image:
          properties:
            type:
              const: image_url
              default: image_url
              title: Type
              type: string
            url:
              description: The URL of the image to process.
              title: Url
              type: string
          required:
          - url
          title: Image
          type: object
      properties:
        input:
          items:
            $ref: '#/components/schemas/PaddleOCRRequest/$defs/Image'
          minItems: 1
          title: Input
          type: array
      required:
      - input
      title: PaddleOCRRequest
      type: object
    PaddleOCRResponse:
      $defs:
        PaddleOCRResponseItem:
          properties:
            index:
              title: Index
              type: integer
            text_detections:
              items:
                $ref: '#/components/schemas/PaddleOCRResponse/$defs/TextDetection'
              title: Text Detections
              type: array
          required:
          - index
          - text_detections
          title: PaddleOCRResponseItem
          type: object
        Point:
          properties:
            x:
              title: X
              type: number
            y:
              title: Y
              type: number
          required:
          - x
          - y
          title: Point
          type: object
        Polygon:
          properties:
            points:
              items:
                $ref: '#/components/schemas/PaddleOCRResponse/$defs/Point'
              title: Points
              type: array
            confidence:
              anyOf:
              - type: number
              - type: 'null'
              default: null
              title: Confidence
          required:
          - points
          title: Polygon
          type: object
        Text:
          properties:
            text:
              title: Text
              type: string
            confidence:
              anyOf:
              - type: number
              - type: 'null'
              default: null
              title: Confidence
          required:
          - text
          title: Text
          type: object
        TextDetection:
          properties:
            text_prediction:
              $ref: '#/components/schemas/PaddleOCRResponse/$defs/Text'
            bounding_box:
              $ref: '#/components/schemas/PaddleOCRResponse/$defs/Polygon'
          required:
          - text_prediction
          - bounding_box
          title: TextDetection
          type: object
        UsageInfo:
          properties:
            images_size_mb:
              title: Images Size Mb
              type: number
          required:
          - images_size_mb
          title: UsageInfo
          type: object
      properties:
        data:
          items:
            $ref: '#/components/schemas/PaddleOCRResponse/$defs/PaddleOCRResponseItem'
          title: Data
          type: array
        usage:
          $ref: '#/components/schemas/PaddleOCRResponse/$defs/UsageInfo'
      required:
      - data
      - usage
      title: PaddleOCRResponse
      type: object
    ErrorResponse:
      properties:
        error:
          title: Error
          type: string
      required:
      - error
      title: ErrorResponse
      type: object
    HealthReadyResponse:
      properties:
        ready:
          title: Ready
          type: boolean
      required:
      - ready
      title: HealthReadyResponse
      type: object
    HealthLiveResponse:
      properties:
        live:
          title: Live
          type: boolean
      required:
      - live
      title: HealthLiveResponse
      type: object
