import streamlit as st from PIL import Image import numpy as np import pubchempy as pcp from rdkit import Chem from rdkit.Chem import Draw st.title("Image Average Pixel Calculator") uploaded_file = st.file_uploader("Upload an image", type=["png", "jpg", "jpeg"]) if uploaded_file: image = Image.open(uploaded_file) for smiles in ["CC=CC", "CC(=O)C"]: cid = pcp.get_compounds(smiles, 'smiles') name = cid[0].synonyms[0] st.markdown("## Option 1 {}".format(name)) m = Chem.MolFromSmiles(smiles) img = Draw.MolToImage(m) st.image(img, use_container_width=False) pubchem_url = "https://pubchem.ncbi.nlm.nih.gov/compound/{}".format(cid[0].cid) st.markdown("[PubChem Link]({})".format(pubchem_url))