jonathang commited on
Commit
3e50ca9
1 Parent(s): 0c29968

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -134,10 +134,11 @@ 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
- 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,5 +153,5 @@ Raw Joined Prediction:
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()
 
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
+ joined_probs = {prot_mappings['id2fam_asc'][str(i)] + ' ' + prot_mappings['fam_asc2fam_id'][prot_mappings['id2fam_asc'][str(i)]]: float(joined_prediction[i]) for i in range(len(joined_prediction))}
138
+ cnn_probs = {prot_mappings['id2fam_asc'][str(i)] + ' ' + prot_mappings['fam_asc2fam_id'][prot_mappings['id2fam_asc'][str(i)]]: float(cnn_raw_prediction[i]) for i in range(len(cnn_raw_prediction))}
139
+ lstm_probs = {prot_mappings['id2fam_asc'][str(i)] + ' ' + prot_mappings['fam_asc2fam_id'][prot_mappings['id2fam_asc'][str(i)]]: float(lstm_raw_prediction[i]) for i in range(len(lstm_raw_prediction))}
140
  gc.collect()
141
+ return joined_probs, cnn_probs, lstm_probs, f"""
142
  Input is {Amino_Acid_Sequence}.
143
  Processed input is:
144
  {processed_seq}
 
153
  {joined_prediction}
154
  """
155
 
156
+ iface = gr.Interface(fn=greet, inputs="text", outputs=[gr.Label(num_top_classes=5, label="Ensemble Family Predictions"), gr.Label(num_top_classes=5, label="CNN Family Predictions"), gr.Label(num_top_classes=5, label="LSTM Family Predictions"), "text"])
157
  iface.launch()