|
@@ -1,3 +1,17 @@
|
|
|
|
|
+# Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved.
|
|
|
|
|
+#
|
|
|
|
|
+# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
+# you may not use this file except in compliance with the License.
|
|
|
|
|
+# You may obtain a copy of the License at
|
|
|
|
|
+#
|
|
|
|
|
+# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
+#
|
|
|
|
|
+# Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
+# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
+# See the License for the specific language governing permissions and
|
|
|
|
|
+# limitations under the License.
|
|
|
|
|
+
|
|
|
from typing import Any, Dict, Final, List, Tuple
|
|
from typing import Any, Dict, Final, List, Tuple
|
|
|
|
|
|
|
|
from paddlex_hps_server import (
|
|
from paddlex_hps_server import (
|
|
@@ -74,7 +88,11 @@ class TritonPythonModel(BaseTritonPythonModel):
|
|
|
)
|
|
)
|
|
|
else:
|
|
else:
|
|
|
file_type = "PDF" if input.fileType == 0 else "IMAGE"
|
|
file_type = "PDF" if input.fileType == 0 else "IMAGE"
|
|
|
- visualize_enabled = input.visualize if input.visualize is not None else self.app_config.visualize
|
|
|
|
|
|
|
+ visualize_enabled = (
|
|
|
|
|
+ input.visualize
|
|
|
|
|
+ if input.visualize is not None
|
|
|
|
|
+ else self.app_config.visualize
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
file_bytes = utils.get_raw_bytes(input.file)
|
|
file_bytes = utils.get_raw_bytes(input.file)
|
|
|
images, data_info = utils.file_to_images(
|
|
images, data_info = utils.file_to_images(
|
|
@@ -94,6 +112,7 @@ class TritonPythonModel(BaseTritonPythonModel):
|
|
|
use_formula_recognition=input.useFormulaRecognition,
|
|
use_formula_recognition=input.useFormulaRecognition,
|
|
|
use_chart_recognition=input.useChartRecognition,
|
|
use_chart_recognition=input.useChartRecognition,
|
|
|
use_region_detection=input.useRegionDetection,
|
|
use_region_detection=input.useRegionDetection,
|
|
|
|
|
+ format_block_content=input.formatBlockContent,
|
|
|
layout_threshold=input.layoutThreshold,
|
|
layout_threshold=input.layoutThreshold,
|
|
|
layout_nms=input.layoutNms,
|
|
layout_nms=input.layoutNms,
|
|
|
layout_unclip_ratio=input.layoutUnclipRatio,
|
|
layout_unclip_ratio=input.layoutUnclipRatio,
|