TongkunGuan commited on
Commit
13d4575
·
verified ·
1 Parent(s): 57a48ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -55,7 +55,7 @@ def load_model(check_type):
55
  return model.to(device), tokenizer, transform, device
56
 
57
  def process_image(model, tokenizer, transform, device, check_type, image, text):
58
- global current_vis, current_bpe
59
  src_size = image.size
60
  if 'TokenOCR' in check_type:
61
  images, target_ratio = dynamic_preprocess(image, min_num=1, max_num=12,
@@ -114,7 +114,7 @@ def process_image(model, tokenizer, transform, device, check_type, image, text):
114
 
115
  # 事件处理函数
116
  def update_index(change):
117
- global current_index
118
  current_index = max(0, min(len(current_vis) - 1, current_index + change))
119
  return current_vis[current_index], format_bpe_display(current_bpe[current_index])
120
 
 
55
  return model.to(device), tokenizer, transform, device
56
 
57
  def process_image(model, tokenizer, transform, device, check_type, image, text):
58
+ global current_vis, current_bpe, current_index
59
  src_size = image.size
60
  if 'TokenOCR' in check_type:
61
  images, target_ratio = dynamic_preprocess(image, min_num=1, max_num=12,
 
114
 
115
  # 事件处理函数
116
  def update_index(change):
117
+ global current_vis, current_bpe, current_index
118
  current_index = max(0, min(len(current_vis) - 1, current_index + change))
119
  return current_vis[current_index], format_bpe_display(current_bpe[current_index])
120