wenkai commited on
Commit
38f9971
·
verified ·
1 Parent(s): 49e2864

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -19,13 +19,13 @@ model.to('cuda')
19
  def generate_caption(protein, prompt):
20
  # Process the image and the prompt
21
  print(f"system path: {os.getcwd()}")
22
- with open('data/fasta/example.fasta', 'w') as f:
23
  f.write('>{}\n'.format("protein_name"))
24
  f.write('{}\n'.format(protein.strip()))
25
  print(f"fasta prepared")
26
- os.system("python esm_scripts/extract.py esm2_t36_3B_UR50D data/fasta/example.fasta data/emb_esm2_3b --repr_layers 36 --truncation_seq_length 1024 --include per_tok")
27
  print(f"protein pt file prepared")
28
- esm_emb = torch.load("data/emb_esm2_3b/protein_name.pt")['representations'][36]
29
  esm_emb = F.pad(esm_emb.t(), (0, 1024 - len(esm_emb))).t().to('cuda')
30
  samples = {'name': ['test_protein'],
31
  'image': torch.unsqueeze(esm_emb, dim=0),
 
19
  def generate_caption(protein, prompt):
20
  # Process the image and the prompt
21
  print(f"system path: {os.getcwd()}")
22
+ with open('/home/user/app/example.fasta', 'w') as f:
23
  f.write('>{}\n'.format("protein_name"))
24
  f.write('{}\n'.format(protein.strip()))
25
  print(f"fasta prepared")
26
+ os.system("python esm_scripts/extract.py esm2_t36_3B_UR50D /home/user/app/example.fasta /home/user/app --repr_layers 36 --truncation_seq_length 1024 --include per_tok")
27
  print(f"protein pt file prepared")
28
+ esm_emb = torch.load("/home/user/app/protein_name.pt")['representations'][36]
29
  esm_emb = F.pad(esm_emb.t(), (0, 1024 - len(esm_emb))).t().to('cuda')
30
  samples = {'name': ['test_protein'],
31
  'image': torch.unsqueeze(esm_emb, dim=0),