a96123155 commited on
Commit
0235b4d
·
1 Parent(s): 85f2ad4
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -478,13 +478,13 @@ def predict_raw(raw_input):
478
  state_dict = torch.load(modelfile, map_location=torch.device(device))
479
  new_state_dict = OrderedDict()
480
 
481
- for k, v in state_dict.items():
482
- name = k.replace('module.','')
483
- new_state_dict[name] = v
484
 
485
- model = CNN_linear().to(device)
486
- model.load_state_dict(new_state_dict, strict = False)
487
- model.eval()
488
 
489
  # st.write('====Parse Input====')
490
  ids, seqs = read_raw(raw_input)
@@ -492,11 +492,11 @@ def predict_raw(raw_input):
492
  # st.write('====Predict====')
493
  res_pd = pd.DataFrame()
494
  for wt_seq, wt_id in zip(seqs, ids):
495
- try:
496
- res = mutated_seq(wt_seq, wt_id)
497
- res_pd.append(res)
498
- except:
499
- st.write('====Please Try Again this sequence: ', wt_id, wt_seq)
500
  # print(pred)
501
  return res_pd
502
 
 
478
  state_dict = torch.load(modelfile, map_location=torch.device(device))
479
  new_state_dict = OrderedDict()
480
 
481
+ for k, v in state_dict.items():
482
+ name = k.replace('module.','')
483
+ new_state_dict[name] = v
484
 
485
+ model = CNN_linear().to(device)
486
+ model.load_state_dict(new_state_dict, strict = False)
487
+ model.eval()
488
 
489
  # st.write('====Parse Input====')
490
  ids, seqs = read_raw(raw_input)
 
492
  # st.write('====Predict====')
493
  res_pd = pd.DataFrame()
494
  for wt_seq, wt_id in zip(seqs, ids):
495
+ try:
496
+ res = mutated_seq(wt_seq, wt_id)
497
+ res_pd.append(res)
498
+ except:
499
+ st.write('====Please Try Again this sequence: ', wt_id, wt_seq)
500
  # print(pred)
501
  return res_pd
502