jonathang commited on
Commit
756e8c2
1 Parent(s): 295491b
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -134,8 +134,10 @@ def greet(Amino_Acid_Sequence):
134
  lstm_fam_id = prot_mappings['fam_asc2fam_id'][lstm_fam_asc]
135
  fam_asc = prot_mappings['id2fam_asc'][str(idx)]
136
  fam_id = prot_mappings['fam_asc2fam_id'][fam_asc]
 
 
137
  gc.collect()
138
- return f"""
139
  Input is {Amino_Acid_Sequence}.
140
  Processed input is:
141
  {processed_seq}
@@ -150,5 +152,5 @@ Raw Joined Prediction:
150
  {joined_prediction}
151
  """
152
 
153
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
154
  iface.launch()
 
134
  lstm_fam_id = prot_mappings['fam_asc2fam_id'][lstm_fam_asc]
135
  fam_asc = prot_mappings['id2fam_asc'][str(idx)]
136
  fam_id = prot_mappings['fam_asc2fam_id'][fam_asc]
137
+ idprobs = {prot_mappings['id2fam_asc'][str(i)]: float(joined_prediction[i]) for i in range(len(joined_prediction))}
138
+ famprobs = {prot_mappings['fam_asc2fam_id'][fam_asc]: pred for fam_asc, pred in idprobs.items()}
139
  gc.collect()
140
+ return famprobs, idprobs, f"""
141
  Input is {Amino_Acid_Sequence}.
142
  Processed input is:
143
  {processed_seq}
 
152
  {joined_prediction}
153
  """
154
 
155
+ iface = gr.Interface(fn=greet, inputs="text", outputs=[gr.Label(num_top_classes=11, label="Family Accession Predictions"), gr.Label(num_top_classes=11, label="Family ID Predictions"), "text"])
156
  iface.launch()