JustinLin610 commited on
Commit
d927d6e
1 Parent(s): d5a6a2f

add modelscope

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -5,10 +5,11 @@ import pandas as pd
5
  os.system('cd fairseq;'
6
  'pip install ./; cd ..')
7
 
8
- os.system('cd ezocr;'
9
- 'pip install .; cd ..')
10
 
11
- os.system('pip install "modelscope[cv]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html')
 
12
 
13
  import torch
14
  import numpy as np
@@ -90,7 +91,6 @@ def draw_boxes(image, bounds, color='red', width=4):
90
  def encode_text(task, text, length=None, append_bos=False, append_eos=False):
91
  bos_item = torch.LongTensor([task.src_dict.bos()])
92
  eos_item = torch.LongTensor([task.src_dict.eos()])
93
- pad_idx = task.src_dict.pad()
94
 
95
  s = task.tgt_dict.encode_line(
96
  line=task.bpe.encode(text),
 
5
  os.system('cd fairseq;'
6
  'pip install ./; cd ..')
7
 
8
+ # os.system('cd ezocr;'
9
+ # 'pip install .; cd ..')
10
 
11
+ os.system('pip install --upgrade tensorflow-gpu==1.15;'
12
+ 'pip install "modelscope[cv]" -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html')
13
 
14
  import torch
15
  import numpy as np
 
91
  def encode_text(task, text, length=None, append_bos=False, append_eos=False):
92
  bos_item = torch.LongTensor([task.src_dict.bos()])
93
  eos_item = torch.LongTensor([task.src_dict.eos()])
 
94
 
95
  s = task.tgt_dict.encode_line(
96
  line=task.bpe.encode(text),