为了支持mixed inference, 重构了目录

This commit is contained in:
三洋三洋
2024-04-17 15:23:30 +00:00
parent 5a9138026f
commit d5eca45fcc
4 changed files with 3 additions and 20 deletions

View File

@@ -13,3 +13,5 @@ onnxruntime
streamlit==1.30
streamlit-paste-button
easyocr

View File

@@ -6,7 +6,6 @@ from pathlib import Path
from utils import to_katex
from models.ocr_model.utils.inference import inference as latex_inference
from models.ocr_model.model.TexTeller import TexTeller
from utils import load_det_tex_model, load_lang_models
if __name__ == '__main__':

1
src/utils/__init__.py Normal file
View File

@@ -0,0 +1 @@
from .to_katex import to_katex

View File

@@ -1,9 +1,6 @@
import numpy as np
import re
from models.ocr_model.utils.inference import inference as latex_inference
def to_katex(formula: str) -> str:
res = formula
res = re.sub(r'\\mbox\{([^}]*)\}', r'\1', res)
@@ -16,19 +13,3 @@ def to_katex(formula: str) -> str:
if res.endswith(r'\newline'):
res = res[:-8]
return res
def load_lang_models(language: str):
...
# language: 'ch' or 'en'
# return det_model, rec_model (or model)
def load_det_tex_model():
...
# return the loaded latex detection model
def mix_inference(latex_det_model, latex_rec_model, lang_model, img: np.ndarray, use_cuda: bool) -> str:
...
# latex_inference(...)