TongkunGuan commited on
Commit
312b679
·
verified ·
1 Parent(s): 758eccd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -14,13 +14,12 @@ from internvl.model.internvl_chat import InternVLChatModel
14
 
15
  # 模型配置
16
  CHECKPOINTS = {
17
- "TokenOCR-4096-English-seg": "/path/to/TokenOCR_4096_English_seg",
18
- "TokenOCR-2048-Bilingual-seg": "/path/to/TokenOCR_2048_Binlinual_seg",
19
- "R50":"model/checkpoint.pth",
20
- "R50_siglip": "/path/to/R50_siglip_checkpoint.pth"
21
  }
22
 
23
  # 全局变量
 
24
  current_vis = []
25
  current_bpe = []
26
  current_index = 0
@@ -42,7 +41,7 @@ def load_model(check_type):
42
 
43
  elif 'TokenOCR' in check_type:
44
  model_path = CHECKPOINTS[check_type]
45
- tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True, use_fast=False)
46
  model = InternVLChatModel.from_pretrained(model_path, torch_dtype=torch.bfloat16).eval()
47
  transform = T.Compose([
48
  T.Lambda(lambda img: img.convert('RGB')),
 
14
 
15
  # 模型配置
16
  CHECKPOINTS = {
17
+ "TokenFD-4096-English-seg": "TongkunGuan/TokenFD_4096_English_seg",
18
+ "TokenFD-2048-Bilingual-seg": "TongkunGuan/TokenFD_2048_Bilingual_seg",
 
 
19
  }
20
 
21
  # 全局变量
22
+ HF_TOKEN = os.getenv("HF_TOKEN")
23
  current_vis = []
24
  current_bpe = []
25
  current_index = 0
 
41
 
42
  elif 'TokenOCR' in check_type:
43
  model_path = CHECKPOINTS[check_type]
44
+ tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True, use_fast=False, use_auth_token=HF_TOKEN)
45
  model = InternVLChatModel.from_pretrained(model_path, torch_dtype=torch.bfloat16).eval()
46
  transform = T.Compose([
47
  T.Lambda(lambda img: img.convert('RGB')),