arcosx commited on
Commit
5e4cf73
·
1 Parent(s): a042b1b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -4
app.py CHANGED
@@ -19,7 +19,24 @@ def predict(smiles):
19
  postprocess_data = '{:.2e}'.format(pow(10, result[0]))
20
  return postprocess_data
21
 
22
- iface = gr.Interface(fn=predict, inputs=gr.Textbox(lines=2, label="Chemical substance SMILES"),
23
- outputs=gr.Textbox(lines=1, label="Cytotoxicity of disinfection byproducts in CHO cells",info="Unit of measurement: molar concentration"),
24
- examples=[["O=C(O)CBr"],["O=CC(Br)(Br)Br"],["IC(Br)Br"]],allow_flagging="never")
25
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  postprocess_data = '{:.2e}'.format(pow(10, result[0]))
20
  return postprocess_data
21
 
22
+
23
+ with gr.Blocks() as demo:
24
+ with gr.Row():
25
+ with gr.Column():
26
+ inputs=gr.Textbox(lines=2, label="Please enter SMILES for the compound")
27
+ with gr.Row():
28
+ btn = gr.Button(variant="primary",value="submit")
29
+ clear_btn = gr.ClearButton(value="clear")
30
+ with gr.Column():
31
+ outputs=gr.Textbox(lines=1, label="Predicted CHO cytotoxicity of the chemical is:",info="Unit: Molar Concentration")
32
+
33
+ btn.click(predict, inputs=[inputs], outputs=[outputs])
34
+ clear_btn.add([inputs,outputs])
35
+
36
+ gr.Examples(
37
+ [["O=C(O)CBr"],["O=CC(Br)(Br)Br"],["IC(Br)Br"]],
38
+ [inputs],
39
+ )
40
+
41
+ if __name__ == "__main__":
42
+ demo.launch()