wenkai commited on
Commit
49e2864
·
verified ·
1 Parent(s): 08b9eb6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -18,10 +18,13 @@ model.to('cuda')
18
  @spaces.GPU
19
  def generate_caption(protein, prompt):
20
  # Process the image and the prompt
 
21
  with open('data/fasta/example.fasta', 'w') as f:
22
  f.write('>{}\n'.format("protein_name"))
23
  f.write('{}\n'.format(protein.strip()))
 
24
  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")
 
25
  esm_emb = torch.load("data/emb_esm2_3b/protein_name.pt")['representations'][36]
26
  esm_emb = F.pad(esm_emb.t(), (0, 1024 - len(esm_emb))).t().to('cuda')
27
  samples = {'name': ['test_protein'],
 
18
  @spaces.GPU
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'],