为了支持mixed inference, 重构了目录
This commit is contained in:
@@ -13,3 +13,5 @@ onnxruntime
|
|||||||
|
|
||||||
streamlit==1.30
|
streamlit==1.30
|
||||||
streamlit-paste-button
|
streamlit-paste-button
|
||||||
|
|
||||||
|
easyocr
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ from pathlib import Path
|
|||||||
from utils import to_katex
|
from utils import to_katex
|
||||||
from models.ocr_model.utils.inference import inference as latex_inference
|
from models.ocr_model.utils.inference import inference as latex_inference
|
||||||
from models.ocr_model.model.TexTeller import TexTeller
|
from models.ocr_model.model.TexTeller import TexTeller
|
||||||
from utils import load_det_tex_model, load_lang_models
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
1
src/utils/__init__.py
Normal file
1
src/utils/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from .to_katex import to_katex
|
||||||
@@ -1,9 +1,6 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from models.ocr_model.utils.inference import inference as latex_inference
|
|
||||||
|
|
||||||
|
|
||||||
def to_katex(formula: str) -> str:
|
def to_katex(formula: str) -> str:
|
||||||
res = formula
|
res = formula
|
||||||
res = re.sub(r'\\mbox\{([^}]*)\}', r'\1', res)
|
res = re.sub(r'\\mbox\{([^}]*)\}', r'\1', res)
|
||||||
@@ -16,19 +13,3 @@ def to_katex(formula: str) -> str:
|
|||||||
if res.endswith(r'\newline'):
|
if res.endswith(r'\newline'):
|
||||||
res = res[:-8]
|
res = res[:-8]
|
||||||
return res
|
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(...)
|
|
||||||
Reference in New Issue
Block a user