oucgc1996 commited on
Commit
4655d1f
·
verified ·
1 Parent(s): 5a0bf69

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -12
app.py CHANGED
@@ -220,18 +220,10 @@ def ACE(file):
220
  test_dict = {"text":test_sequences, 'structure':test_Structure_index}
221
  print("=================================Structure prediction========================")
222
  for i in tqdm(range(0, len(test_sequences))):
223
- while True:
224
- command = ["curl", "-X", "POST", "-k", "--data", f"{test_sequences[i]}", "https://api.esmatlas.com/foldSequence/v1/pdb/"]
225
- result = subprocess.run(command, capture_output=True, text=True)
226
- with open(os.path.join(pdb_path, f'{test_Structure_index[i]}.pdb'), 'w') as file:
227
- file.write(result.stdout)
228
- stats = os.stat(os.path.join(pdb_path, f'{test_Structure_index[i]}.pdb'))
229
- if stats.st_size < 1024:
230
- print(f"Download for {test_Structure_index[i]} failed due to empty file. Retrying...")
231
- time.sleep(20)
232
- continue
233
- else:
234
- break
235
  test_data=MyDataset(test_dict)
236
  test_dataloader=DataLoader(test_data,batch_size=batch_size,collate_fn=collate_fn,shuffle=False)
237
 
@@ -250,6 +242,8 @@ def ACE(file):
250
  batchs = {k: v for k, v in batch.items()}
251
  outputs = model(structure_fea, batchs, fingerprint)
252
  probability = outputs[0].tolist()
 
 
253
  train_argmax = np.argmax(outputs.cpu().detach().numpy(), axis=1)
254
  for j in range(0,len(train_argmax)):
255
  output = train_argmax[j]
 
220
  test_dict = {"text":test_sequences, 'structure':test_Structure_index}
221
  print("=================================Structure prediction========================")
222
  for i in tqdm(range(0, len(test_sequences))):
223
+ command = ["curl", "-X", "POST", "-k", "--data", f"{test_sequences[i]}", "https://api.esmatlas.com/foldSequence/v1/pdb/"]
224
+ result = subprocess.run(command, capture_output=True, text=True)
225
+ with open(os.path.join(pdb_path, f'{test_Structure_index[i]}.pdb'), 'w') as file:
226
+ file.write(result.stdout)
 
 
 
 
 
 
 
 
227
  test_data=MyDataset(test_dict)
228
  test_dataloader=DataLoader(test_data,batch_size=batch_size,collate_fn=collate_fn,shuffle=False)
229
 
 
242
  batchs = {k: v for k, v in batch.items()}
243
  outputs = model(structure_fea, batchs, fingerprint)
244
  probability = outputs[0].tolist()
245
+ print(outputs)
246
+ print(probability)
247
  train_argmax = np.argmax(outputs.cpu().detach().numpy(), axis=1)
248
  for j in range(0,len(train_argmax)):
249
  output = train_argmax[j]