--- license: mit datasets: - lisn519010/QM9 language: - en - zh metrics: - mae - accuracy - r_squared - mse pipeline_tag: graph-ml --- ``` pip install transformers gradio rdkit torch torch_scatter torch_sparse torch_geometric ``` ```python import gradio as gr from transformers import AutoModel def predict_smiles(name): device = 'cpu' smiles = name assert isinstance(smiles, str), 'smiles must be str' smiles = smiles.strip() if ';' in smiles: smiles = smiles.split(";") elif ' ' in smiles: smiles = smiles.split(" ") elif ',' in smiles: smiles = smiles.split(",") else: smiles = [smiles] model = AutoModel.from_pretrained("Huhujingjing/custom-mxm", trust_remote_code=True).to(device) output, df = model.predict_smiles(smiles) return output, df iface = gr.Interface(fn=predict_smiles, inputs="text", outputs=["text", "dataframe"]) iface.launch(share=True) ```