Nazarshia2889 commited on
Commit
ac3d524
1 Parent(s): 3fae50d

model update

Browse files
Files changed (2) hide show
  1. app.py +37 -34
  2. bcell/tf_model.h5 +1 -1
app.py CHANGED
@@ -4,7 +4,7 @@ from transformers import AutoTokenizer
4
  import pandas as pd
5
 
6
  # title
7
- st.title('Raven AI')
8
 
9
  # text input with label
10
  sequence = st.text_input('Enter Amino Acid Sequence')
@@ -14,8 +14,8 @@ model_type = st.radio(
14
  ('Linear T-Cells (MHC Class I Restriction)', 'Linear T-Cells (MHC Class II Restriction)', 'Linear B-Cell'))
15
 
16
  # windows length slider
17
- length = st.slider('Window Length', 1, 20, 10)
18
- threshold = st.slider('Probability Threshold', 0.0, 1.0, 0.5)
19
 
20
  model_checkpoint = "facebook/esm2_t6_8M_UR50D"
21
 
@@ -29,34 +29,37 @@ elif model_type == 'Linear B-Cell':
29
  model = TFAutoModelForSequenceClassification.from_pretrained('bcell')
30
  # submit button
31
  if st.button('Submit'):
32
- # run model
33
- locations = []
34
- for i in range(len(sequence) - length):
35
- peptide_name = sequence[i:i+length]
36
- peptide = tokenizer(peptide_name, return_tensors="tf")
37
- output = model(peptide)
38
- locations.append([peptide_name, output.logits.numpy()[0][0]])
39
-
40
- locations = pd.DataFrame(locations, columns = ['Peptide', 'Probability'])
41
-
42
- # display table with sequence and probability as the headers
43
- def color_survived(x: float): # x between 0 and 1
44
- # red to green scale based on x
45
- # 0 -> red
46
- # 0.5 -> clear
47
- # 1 -> green
48
-
49
- # red
50
- if x < threshold:
51
- r = 179
52
- g = 40
53
- b = 2
54
- # green
55
- else:
56
- r = 18
57
- g = 150
58
- b = 6
59
-
60
- return f'background-color: rgb({r}, {g}, {b})'
61
-
62
- st.table(locations.style.applymap(color_survived, subset=['Probability']))
 
 
 
 
4
  import pandas as pd
5
 
6
  # title
7
+ st.title('Ravens AI')
8
 
9
  # text input with label
10
  sequence = st.text_input('Enter Amino Acid Sequence')
 
14
  ('Linear T-Cells (MHC Class I Restriction)', 'Linear T-Cells (MHC Class II Restriction)', 'Linear B-Cell'))
15
 
16
  # windows length slider
17
+ length = st.slider('Window Length', 1, 50, 10)
18
+ threshold = st.slider('Probability Threshold', 0.0, 1.0, 0.75)
19
 
20
  model_checkpoint = "facebook/esm2_t6_8M_UR50D"
21
 
 
29
  model = TFAutoModelForSequenceClassification.from_pretrained('bcell')
30
  # submit button
31
  if st.button('Submit'):
32
+ if(length > len(sequence)):
33
+ st.write("Please make sure that your window length is less than the sequence length!")
34
+ else:
35
+ # run model
36
+ locations = []
37
+ for i in range(len(sequence) - length + 1):
38
+ peptide_name = sequence[i:i+length]
39
+ peptide = tokenizer(peptide_name, return_tensors="tf")
40
+ output = model(peptide)
41
+ locations.append([peptide_name, output.logits.numpy()[0][0]])
42
+
43
+ locations = pd.DataFrame(locations, columns = ['Peptide', 'Probability'])
44
+
45
+ # display table with sequence and probability as the headers
46
+ def color_survived(x: float): # x between 0 and 1
47
+ # red to green scale based on x
48
+ # 0 -> red
49
+ # 0.5 -> clear
50
+ # 1 -> green
51
+
52
+ # red
53
+ if x < threshold:
54
+ r = 179
55
+ g = 40
56
+ b = 2
57
+ # green
58
+ else:
59
+ r = 18
60
+ g = 150
61
+ b = 6
62
+
63
+ return f'background-color: rgb({r}, {g}, {b})'
64
+
65
+ st.table(locations.style.applymap(color_survived, subset=['Probability']))
bcell/tf_model.h5 CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:fc764936c96b97e3e5678e26e08f8e96eb7a1effaabc4b8cc1173471f0c3eb5d
3
  size 30211508
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4e1cffc07e744025c7efe0ae8a4e3081fbb5f68f6b9c88b3ccfe0b96979929f1
3
  size 30211508