Update app.py
Browse files
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('
|
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
|
27 |
print(f"protein pt file prepared")
|
28 |
-
esm_emb = torch.load("
|
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),
|