ndhieunguyen commited on
Commit
d7ac3f6
·
1 Parent(s): 0dc0d33

feat: change result structure

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -136,6 +136,12 @@ def gradio_process_fasta(fasta_text):
136
  """
137
  fasta_dict = process_fasta(fasta_text)
138
  result = predictor.predict(fasta_dict)
 
 
 
 
 
 
139
  return result
140
 
141
 
@@ -145,7 +151,7 @@ interface = gr.Interface(
145
  label="Enter FASTA format text", lines=10, placeholder=">id1\nATGC\n>id2\nCGTA"
146
  ),
147
  outputs=gr.JSON(label="Processed FASTA Dictionary with Probabilities and Classes"),
148
- title="FASTA to Dictionary with Probabilities and Classes",
149
  description=("Enter a FASTA-formatted text"),
150
  )
151
  # Launch the Gradio app
 
136
  """
137
  fasta_dict = process_fasta(fasta_text)
138
  result = predictor.predict(fasta_dict)
139
+ new_result = {}
140
+ for key, value in result.items():
141
+ if value[1] == 1:
142
+ new_result[key] = {"probability": value[0], "class": "bitter"}
143
+ else:
144
+ new_result[key] = {"probability": 1 - value[0], "class": "non-bitter"}
145
  return result
146
 
147
 
 
151
  label="Enter FASTA format text", lines=10, placeholder=">id1\nATGC\n>id2\nCGTA"
152
  ),
153
  outputs=gr.JSON(label="Processed FASTA Dictionary with Probabilities and Classes"),
154
+ title="xBitterT5",
155
  description=("Enter a FASTA-formatted text"),
156
  )
157
  # Launch the Gradio app