wg25r
commited on
Commit
·
dd65b38
1
Parent(s):
7287a0b
simple_ui
Browse files- app.py +14 -7
- requirements.txt +2 -1
app.py
CHANGED
@@ -1,15 +1,22 @@
|
|
1 |
import streamlit as st
|
2 |
from PIL import Image
|
3 |
import numpy as np
|
|
|
|
|
|
|
4 |
|
5 |
st.title("Image Average Pixel Calculator")
|
6 |
uploaded_file = st.file_uploader("Upload an image", type=["png", "jpg", "jpeg"])
|
7 |
if uploaded_file:
|
8 |
image = Image.open(uploaded_file)
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
from PIL import Image
|
3 |
import numpy as np
|
4 |
+
import pubchempy as pcp
|
5 |
+
from rdkit import Chem
|
6 |
+
from rdkit.Chem import Draw
|
7 |
|
8 |
st.title("Image Average Pixel Calculator")
|
9 |
uploaded_file = st.file_uploader("Upload an image", type=["png", "jpg", "jpeg"])
|
10 |
if uploaded_file:
|
11 |
image = Image.open(uploaded_file)
|
12 |
+
|
13 |
+
|
14 |
+
for smiles in ["CC=CC", "CC(=O)C"]:
|
15 |
+
cid = pcp.get_compounds(smiles, 'smiles')
|
16 |
+
name = cid[0].synonyms[0]
|
17 |
+
st.markdown("## Option 1 {}".format(name))
|
18 |
+
m = Chem.MolFromSmiles(smiles)
|
19 |
+
img = Draw.MolToImage(m)
|
20 |
+
st.image(img, use_container_width=False)
|
21 |
+
pubchem_url = "https://pubchem.ncbi.nlm.nih.gov/compound/{}".format(cid[0].cid)
|
22 |
+
st.markdown("[PubChem Link]({})".format(pubchem_url))
|
requirements.txt
CHANGED
@@ -1 +1,2 @@
|
|
1 |
-
pubchempy
|
|
|
|
1 |
+
pubchempy
|
2 |
+
rdkit
|