Spaces:
Paused
Paused
Commit ·
bf6dd26
1
Parent(s): 3b2506d
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,19 +2,28 @@ import streamlit as st
|
|
| 2 |
from transformers import AutoTokenizer, EsmModel
|
| 3 |
import torch
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 7 |
model = EsmModel.from_pretrained(model_name)
|
| 8 |
|
| 9 |
aa_seq = st.text_input('Type AA sequance here')
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
last_hidden_states = outputs.last_hidden_state
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
st.write('Model:', model_name)
|
| 17 |
-
st.write('Last hidden state shape:', last_hidden_states.shape)
|
| 18 |
-
st.write('Last hidden states:')
|
| 19 |
-
st.write(last_hidden_states)
|
| 20 |
st.write('Also, Dania is not gay')
|
|
|
|
| 2 |
from transformers import AutoTokenizer, EsmModel
|
| 3 |
import torch
|
| 4 |
|
| 5 |
+
|
| 6 |
+
model_name = st.multiselect(
|
| 7 |
+
'Choose a model',
|
| 8 |
+
["facebook/esm2_t6_8M_UR50D", "facebook/esm2_t48_15B_UR50D"],
|
| 9 |
+
["facebook/esm2_t6_8M_UR50D"])
|
| 10 |
+
|
| 11 |
+
st.write('You selected model:', model_name)
|
| 12 |
+
|
| 13 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 14 |
model = EsmModel.from_pretrained(model_name)
|
| 15 |
|
| 16 |
aa_seq = st.text_input('Type AA sequance here')
|
| 17 |
|
| 18 |
+
def embed(aa_seq):
|
| 19 |
+
inputs = tokenizer(aa_seq, return_tensors="pt")
|
| 20 |
+
outputs = model(**inputs)
|
| 21 |
+
last_hidden_states = outputs.last_hidden_state
|
| 22 |
+
st.write('Last hidden state shape:', last_hidden_states.shape)
|
| 23 |
+
st.write('Last hidden states:')
|
| 24 |
+
st.write(last_hidden_states)
|
| 25 |
+
|
| 26 |
+
if st.button('Run Function'):
|
| 27 |
+
embed(aa_seq)
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
st.write('Also, Dania is not gay')
|