Update app.py
Browse files
app.py
CHANGED
@@ -30,6 +30,7 @@ def get_model(type='Molecule Function'):
|
|
30 |
elif type == 'Cellar Component':
|
31 |
model.load_checkpoint("model/checkpoint_cc2.pth")
|
32 |
model.to('cuda')
|
|
|
33 |
|
34 |
|
35 |
models = {
|
@@ -161,8 +162,15 @@ def generate_caption(model_id, protein, prompt):
|
|
161 |
if t_standard not in temp:
|
162 |
pred_terms.append(t_standard+f'({prob})')
|
163 |
temp.append(t_standard)
|
164 |
-
|
165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
return res_str
|
167 |
# return "test"
|
168 |
|
|
|
30 |
elif type == 'Cellar Component':
|
31 |
model.load_checkpoint("model/checkpoint_cc2.pth")
|
32 |
model.to('cuda')
|
33 |
+
return model
|
34 |
|
35 |
|
36 |
models = {
|
|
|
162 |
if t_standard not in temp:
|
163 |
pred_terms.append(t_standard+f'({prob})')
|
164 |
temp.append(t_standard)
|
165 |
+
res_str = "No available predictions for this protein! You can try the other two types of model or remove prompt."
|
166 |
+
if len(pred_terms) == 0:
|
167 |
+
return res_str
|
168 |
+
if model_id == 'Molecule Function':
|
169 |
+
res_str = f"Based on the given amino acid sequence, the protein appears to have a primary function of {', '.join(pred_terms)}"
|
170 |
+
elif model_id == 'Biological Process':
|
171 |
+
res_str = f"Based on the given amino acid sequence, it is likely involved in the {', '.join(pred_terms)}"
|
172 |
+
elif model_id == 'Cellar Component':
|
173 |
+
res_str = f"Based on the given amino acid sequence, it's subcellular localization is within the {', '.join(pred_terms)}"
|
174 |
return res_str
|
175 |
# return "test"
|
176 |
|