File size: 774 Bytes
3437d14
ce52bcc
 
3437d14
bf6dd26
6d84961
bf6dd26
6d84961
bf6dd26
 
 
ce52bcc
 
 
 
 
bf6dd26
 
 
 
 
 
 
 
 
 
ce52bcc
3b2506d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import streamlit as st
from transformers import AutoTokenizer, EsmModel
import torch


model_name = st.selectbox(
    'Choose a model',
    ["facebook/esm2_t6_8M_UR50D", "facebook/esm2_t48_15B_UR50D"])

st.write('You selected model:', model_name)

tokenizer = AutoTokenizer.from_pretrained(model_name)
model = EsmModel.from_pretrained(model_name)

aa_seq = st.text_input('Type AA sequance here')

def embed(aa_seq):
    inputs = tokenizer(aa_seq, return_tensors="pt")
    outputs = model(**inputs)
    last_hidden_states = outputs.last_hidden_state
    st.write('Last hidden state shape:', last_hidden_states.shape)
    st.write('Last hidden states:')
    st.write(last_hidden_states)
    
if st.button('Run Function'):
    embed(aa_seq)

st.write('Also, Dania is not gay')