File size: 771 Bytes
8f8ddfc dd65b38 8f8ddfc dd65b38 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
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)) |