Spaces:
Running
Running
Update interfaces/iupac2smiles.py
Browse files
interfaces/iupac2smiles.py
CHANGED
@@ -2,8 +2,6 @@ import gradio as gr
|
|
2 |
from utils import ChemicalConverter, validate_smiles2iupac, plot_mol, login
|
3 |
|
4 |
def convert(access_code, chemical_name, plot):
|
5 |
-
if not login(access_code):
|
6 |
-
return "Currently, you don't have access to the service.", plot_mol("CCO")
|
7 |
# Initialize the ChemicalConverter
|
8 |
converter = ChemicalConverter(mode="IUPAC2SMILES")
|
9 |
converted_name = ""
|
@@ -18,13 +16,12 @@ iupac2smiles = gr.Interface(
|
|
18 |
fn=convert,
|
19 |
allow_flagging='auto',
|
20 |
inputs=[
|
21 |
-
gr.Textbox(label="Enter your access code", placeholder=""),
|
22 |
gr.Textbox(label="Enter your IUPAC name", placeholder="Enter IUPAC name here"),
|
23 |
gr.Checkbox(label="Plot molecule", value=True)
|
24 |
],
|
25 |
outputs=[gr.Text(label="Converted Name"),
|
26 |
gr.Image(type='pil', label="Molecule Plot", height=170, width=890)],
|
27 |
examples=[
|
28 |
-
[
|
29 |
],
|
30 |
)
|
|
|
2 |
from utils import ChemicalConverter, validate_smiles2iupac, plot_mol, login
|
3 |
|
4 |
def convert(access_code, chemical_name, plot):
|
|
|
|
|
5 |
# Initialize the ChemicalConverter
|
6 |
converter = ChemicalConverter(mode="IUPAC2SMILES")
|
7 |
converted_name = ""
|
|
|
16 |
fn=convert,
|
17 |
allow_flagging='auto',
|
18 |
inputs=[
|
|
|
19 |
gr.Textbox(label="Enter your IUPAC name", placeholder="Enter IUPAC name here"),
|
20 |
gr.Checkbox(label="Plot molecule", value=True)
|
21 |
],
|
22 |
outputs=[gr.Text(label="Converted Name"),
|
23 |
gr.Image(type='pil', label="Molecule Plot", height=170, width=890)],
|
24 |
examples=[
|
25 |
+
["ethanol", True]
|
26 |
],
|
27 |
)
|