MinerU / app.py
kitjesen's picture
Upload 9 files
d282272 verified
raw
history blame
646 Bytes
from transformers import PreTrainedModel
from typing import Optional
import torch
class MinerUModel(PreTrainedModel):
def __init__(self, config):
super().__init__(config)
self.config = config
@staticmethod
def load_model():
from model_loader import MinerUModelLoader
return MinerUModelLoader.load_models("./")
def forward(self, input_data):
# 实现前向传播逻辑
pass
def load_model():
model = MinerUModel.from_pretrained("./")
return model
def inference(pdf_content):
model = load_model()
return model(pdf_content)