savakholin commited on
Commit
afba882
·
1 Parent(s): 6d84961

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import streamlit as st
2
  from transformers import AutoTokenizer, EsmModel
3
  import torch
 
4
 
5
 
6
  model_name = st.selectbox(
@@ -21,6 +22,21 @@ def embed(aa_seq):
21
  st.write('Last hidden state shape:', last_hidden_states.shape)
22
  st.write('Last hidden states:')
23
  st.write(last_hidden_states)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  if st.button('Run Function'):
26
  embed(aa_seq)
 
1
  import streamlit as st
2
  from transformers import AutoTokenizer, EsmModel
3
  import torch
4
+ import json
5
 
6
 
7
  model_name = st.selectbox(
 
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
+ data = {
27
+ 'aa_seq':aa_seq,
28
+ 'last_hidden_states':last_hidden_states
29
+ }
30
+ json_data = json.dumps(data)
31
+
32
+
33
+ st.download_button(
34
+ label="Download JSON file",
35
+ data=json_data,
36
+ file_name="esm-2 last hidden states.json",
37
+ mime='application/json'
38
+ )
39
+
40
 
41
  if st.button('Run Function'):
42
  embed(aa_seq)