oucgc1996 commited on
Commit
41d85ec
·
verified ·
1 Parent(s): f19339e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -66,15 +66,16 @@ def ACE(file):
66
  for seq in all:
67
  test_data = tokenizer(seq, max_length=max_len, padding="max_length",truncation=True, return_tensors='pt')
68
  out_probability = []
69
- predict = model(test_data)
70
- out_probability.extend(np.max(np.array(predict.cpu()),axis=1).tolist())
71
- test_argmax = np.argmax(predict.cpu(), axis=1).tolist()
72
- id2str = {0:"non-ACE", 1:"ACE"}
73
- output = id2str[test_argmax[0]]
74
- probability = out_probability[0]
75
- seq_all.append(seq)
76
- output_all.append(output)
77
- probability_all.append(probability)
 
78
 
79
  summary = OrderedDict()
80
  summary['Seq'] = seq_all
 
66
  for seq in all:
67
  test_data = tokenizer(seq, max_length=max_len, padding="max_length",truncation=True, return_tensors='pt')
68
  out_probability = []
69
+ with torch.no_grad():
70
+ predict = model(test_data)
71
+ out_probability.extend(np.max(np.array(predict.cpu()),axis=1).tolist())
72
+ test_argmax = np.argmax(predict.cpu(), axis=1).tolist()
73
+ id2str = {0:"non-ACE", 1:"ACE"}
74
+ output = id2str[test_argmax[0]]
75
+ probability = out_probability[0]
76
+ seq_all.append(seq)
77
+ output_all.append(output)
78
+ probability_all.append(probability)
79
 
80
  summary = OrderedDict()
81
  summary['Seq'] = seq_all