changdazhou 7 luni în urmă
părinte
comite
ce287f4f61

+ 4 - 4
paddlex/configs/pipelines/PP-StructureV3.yaml

@@ -111,8 +111,8 @@ SubPipelines:
         module_name: text_detection
         model_name: PP-OCRv4_server_det
         model_dir: null
-        limit_side_len: 1200
-        limit_type: max
+        limit_side_len: 736
+        limit_type: min
         thresh: 0.3
         box_thresh: 0.4
         unclip_ratio: 2.0
@@ -170,8 +170,8 @@ SubPipelines:
             module_name: text_detection
             model_name: PP-OCRv4_server_det
             model_dir: null
-            limit_side_len: 1200
-            limit_type: max
+            limit_side_len: 736
+            limit_type: min
             thresh: 0.3
             box_thresh: 0.4
             unclip_ratio: 2.0

+ 0 - 7
paddlex/inference/pipelines/components/retriever/openai_bot_retriever.py

@@ -23,13 +23,6 @@ class OpenAIBotRetriever(BaseRetriever):
         "openai",
     ]
 
-    MODELS = [
-        "tao-8k",
-        "embedding-v1",
-        "bge-large-zh",
-        "bge-large-en",
-    ]
-
     def __init__(self, config: Dict) -> None:
         """
         Initializes the OpenAIBotRetriever instance with the provided configuration.

+ 1 - 0
paddlex/repo_manager/requirements.txt

@@ -10,6 +10,7 @@ premailer
 python-docx
 ######## For Chatocrv3 #######
 langchain==0.2.17
+langchain-openai==0.1.25
 langchain-community==0.2.17
 langchain-text-splitters==0.2.4
 transformers==4.40.0

+ 9 - 2
paddlex/utils/fonts/__init__.py

@@ -12,11 +12,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-
 from pathlib import Path
 
 import PIL
 from PIL import ImageFont
+from .. import logging
+from ..download import download
 
 
 def get_font_file_path(file_name: str) -> str:
@@ -26,8 +27,14 @@ def get_font_file_path(file_name: str) -> str:
     Returns:
     str: The path to the font file.
     """
+    font_path = (Path(__file__).parent / file_name).resolve().as_posix()
+    if not Path(font_path).exists():
+        download(
+            url=f"https://paddle-model-ecology.bj.bcebos.com/paddlex/PaddleX3.0/fonts/{file_name}",
+            save_path=font_path,
+        )
 
-    return (Path(__file__).parent / file_name).resolve().as_posix()
+    return font_path
 
 
 def create_font(txt: str, sz: tuple, font_path: str) -> ImageFont:

+ 1 - 0
requirements.txt

@@ -34,6 +34,7 @@ ujson
 Pillow
 ######## For Chatocrv3 #######
 langchain==0.2.17
+langchain-openai==0.1.25
 langchain-community==0.2.17
 langchain-text-splitters==0.2.4
 transformers==4.40.0

+ 4 - 4
setup.py

@@ -93,16 +93,16 @@ def packages_and_package_data():
     pkg_data.append("inference/pipelines/ppchatocrv3/ch_prompt.yaml")
     pkg_data.extend(pipeline_config)
     pkg_data.append(".version")
-    pkg_data.append("utils/fonts/PingFang-SC-Regular.ttf")
     pkg_data.append("repo_manager/requirements.txt")
     pkg_data.append("serving_requirements.txt")
     pkg_data.append("paddle2onnx_requirements.txt")
     pkg_data.append("hpip_links.html")
-    ops_file_dir = 'paddlex/ops'
-    ops_file_types = ['h', 'hpp', 'cpp', 'cc', 'cu']
+    ops_file_dir = "paddlex/ops"
+    ops_file_types = ["h", "hpp", "cpp", "cc", "cu"]
     return pkgs, {
         "paddlex.ops": get_data_files(ops_file_dir, ops_file_types),
-        "paddlex": pkg_data}
+        "paddlex": pkg_data,
+    }
 
 
 if __name__ == "__main__":