wenkai commited on
Commit
1167137
1 Parent(s): f3ed046

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -127,13 +127,19 @@ def generate_caption(protein, prompt):
127
  x = prediction[0]
128
  x = [eval(i) for i in x.split('; ')]
129
  pred_terms = []
 
130
  for i in x:
131
  txt = i[0]
132
  prob = i[1]
133
  sim_list = difflib.get_close_matches(txt.lower(), choices, n=1, cutoff=0.9)
134
  if len(sim_list) > 0:
135
- pred_terms.append((sim_list[0], prob))
136
- return str(pred_terms)
 
 
 
 
 
137
  # return "test"
138
 
139
 
 
127
  x = prediction[0]
128
  x = [eval(i) for i in x.split('; ')]
129
  pred_terms = []
130
+ temp = []
131
  for i in x:
132
  txt = i[0]
133
  prob = i[1]
134
  sim_list = difflib.get_close_matches(txt.lower(), choices, n=1, cutoff=0.9)
135
  if len(sim_list) > 0:
136
+ t_standard = sim_list[0]
137
+ if t_standard not in temp:
138
+ pred_terms.append(t_standard+f'(prob)')
139
+ temp.append(t_standard)
140
+
141
+ res_str = f"Based on the given amino acid sequence, the proteinappears to have a primary function of {', '.join(pred_terms)}"
142
+ return res_str
143
  # return "test"
144
 
145