wg25r
commited on
Commit
·
ad17ff1
1
Parent(s):
ac549f4
better UI
Browse files
app.py
CHANGED
@@ -10,6 +10,7 @@ import random
|
|
10 |
|
11 |
@st.dialog("Select From Library")
|
12 |
def lib_modal():
|
|
|
13 |
files = os.listdir("lib")
|
14 |
files = random.choices(files, k=50)
|
15 |
cols = st.columns(2)
|
@@ -18,9 +19,15 @@ def lib_modal():
|
|
18 |
st.image("lib/{}".format(file), use_container_width=True)
|
19 |
if st.button("Select", key=i):
|
20 |
st.session_state.uploaded_file = file
|
|
|
21 |
st.rerun()
|
22 |
st.markdown("---")
|
23 |
|
|
|
|
|
|
|
|
|
|
|
24 |
st.title("3D2SMILES")
|
25 |
st.markdown("""
|
26 |
This app generates SMILES strings from images of molecules ball-and-stick models.
|
@@ -45,9 +52,12 @@ if mode == "Upload File":
|
|
45 |
col1.checkbox("Contribute To Public Library", value=True, help="If checked, images will be included in the PUBLIC library, and the image will be reviewed by our team and used for model training. When checked, do not upload any sensitive or personal data.")
|
46 |
else:
|
47 |
uploaded_file = None
|
|
|
48 |
from_library = st.button("Select from Library")
|
49 |
if from_library:
|
50 |
-
|
|
|
|
|
51 |
if "uploaded_file" in st.session_state:
|
52 |
st.markdown("You have selected: {}".format(st.session_state.uploaded_file))
|
53 |
|
|
|
10 |
|
11 |
@st.dialog("Select From Library")
|
12 |
def lib_modal():
|
13 |
+
# if st.button("Confirm", key="confirm"):
|
14 |
files = os.listdir("lib")
|
15 |
files = random.choices(files, k=50)
|
16 |
cols = st.columns(2)
|
|
|
19 |
st.image("lib/{}".format(file), use_container_width=True)
|
20 |
if st.button("Select", key=i):
|
21 |
st.session_state.uploaded_file = file
|
22 |
+
st.session_state.show_modal = False
|
23 |
st.rerun()
|
24 |
st.markdown("---")
|
25 |
|
26 |
+
|
27 |
+
|
28 |
+
if "show_modal" not in st.session_state:
|
29 |
+
st.session_state.show_modal = True
|
30 |
+
|
31 |
st.title("3D2SMILES")
|
32 |
st.markdown("""
|
33 |
This app generates SMILES strings from images of molecules ball-and-stick models.
|
|
|
52 |
col1.checkbox("Contribute To Public Library", value=True, help="If checked, images will be included in the PUBLIC library, and the image will be reviewed by our team and used for model training. When checked, do not upload any sensitive or personal data.")
|
53 |
else:
|
54 |
uploaded_file = None
|
55 |
+
st.warning("You are accessing a user-uploaded library. These images are unverified, unmoderated, and may include inappropriate content or incorrectly assembled files. Proceed at your own risk. For inquiries, contact us.")
|
56 |
from_library = st.button("Select from Library")
|
57 |
if from_library:
|
58 |
+
if st.session_state.show_modal:
|
59 |
+
lib_modal()
|
60 |
+
|
61 |
if "uploaded_file" in st.session_state:
|
62 |
st.markdown("You have selected: {}".format(st.session_state.uploaded_file))
|
63 |
|