fix: refact logic
This commit is contained in:
@@ -5,6 +5,7 @@ from pathlib import Path
|
||||
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
import torch
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
@@ -21,11 +22,10 @@ class Settings(BaseSettings):
|
||||
debug: bool = False
|
||||
|
||||
# PaddleOCR-VL Settings
|
||||
paddleocr_vl_url: str = "http://localhost:8080/v1"
|
||||
paddleocr_vl_url: str = "http://127.0.0.1:8000/v1"
|
||||
|
||||
# Model Paths
|
||||
doclayout_model_path: str = "app/model/DocLayout/best.pt"
|
||||
pp_doclayout_model_dir: str = "app/model/PP-DocLayout/PP-DocLayoutV2"
|
||||
pp_doclayout_model_dir: Optional[str] = "/home/yoge/.cache/modelscope/hub/models/PaddlePaddle/PP-DocLayoutV2"
|
||||
|
||||
# Image Processing
|
||||
max_image_size_mb: int = 10
|
||||
@@ -37,11 +37,6 @@ class Settings(BaseSettings):
|
||||
host: str = "0.0.0.0"
|
||||
port: int = 8053
|
||||
|
||||
@property
|
||||
def doclayout_model_file(self) -> Path:
|
||||
"""Get the DocLayout model file path."""
|
||||
return Path(self.doclayout_model_path)
|
||||
|
||||
@property
|
||||
def pp_doclayout_dir(self) -> Path:
|
||||
"""Get the PP-DocLayout model directory path."""
|
||||
|
||||
Reference in New Issue
Block a user