Emaad commited on
Commit
636ed51
1 Parent(s): 91fbf43

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -1
app.py CHANGED
@@ -8,6 +8,18 @@ from celle_main import instantiate_from_config
8
  from omegaconf import OmegaConf
9
  from huggingface_hub import hf_hub_download
10
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  class model:
12
  def __init__(self):
13
  self.model = None
@@ -75,8 +87,13 @@ class model:
75
  model=self.model,
76
  device=device,
77
  )
 
 
 
 
 
78
 
79
- return T.ToPILImage()(protein_image[0,0]), T.ToPILImage()(nucleus_image[0,0]), formatted_predicted_sequence.replace("<pad>", "")
80
 
81
  base_class = model()
82
 
 
8
  from omegaconf import OmegaConf
9
  from huggingface_hub import hf_hub_download
10
 
11
+ def bold_predicted_letters(input_string: str, output_string: str) -> str:
12
+ result = []
13
+ i = 0
14
+ while i < len(input_string):
15
+ if input_string[i:i+6] == "<mask>":
16
+ result.append("**" + output_string[i] + "**")
17
+ i += 6
18
+ else:
19
+ result.append(output_string[i])
20
+ i += 1
21
+ return "".join(result)
22
+
23
  class model:
24
  def __init__(self):
25
  self.model = None
 
87
  model=self.model,
88
  device=device,
89
  )
90
+
91
+ formatted_predicted_sequence = formatted_predicted_sequence.replace("<pad>","")
92
+ formatted_predicted_sequence = formatted_predicted_sequence("<start>","")
93
+ formatted_predicted_sequence = formatted_predicted_sequence("<end>","")
94
+ formatted_predicted_sequence = bold_predicted_letters(sequence_input, formatted_predicted_sequence)
95
 
96
+ return T.ToPILImage()(protein_image[0,0]), T.ToPILImage()(nucleus_image[0,0]),
97
 
98
  base_class = model()
99