Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
@@ -6,43 +6,44 @@ import streamlit_ketcher
|
|
6 |
from streamlit_ketcher import st_ketcher
|
7 |
import abcBERT
|
8 |
import RF
|
9 |
-
|
|
|
10 |
# Page setup
|
11 |
st.set_page_config(page_title="DeepAcceptor", page_icon="🔋", layout="wide")
|
12 |
st.title("🔋DeepAcceptor")
|
13 |
|
14 |
# Connect to the Google Sheet
|
15 |
-
|
16 |
-
|
17 |
df1 = pd.read_csv(url1, dtype=str, encoding='utf-8')
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
|
|
24 |
if text_search:
|
|
|
|
|
25 |
st.write(df_search)
|
26 |
st.download_button( "⬇️ Download edited files as .csv", df_search.to_csv(), "df_search.csv", use_container_width=True)
|
27 |
edited_df = st.data_editor(df1, num_rows="dynamic")
|
28 |
-
|
29 |
st.download_button(
|
30 |
"⬇️ Download edited files as .csv", edited_df.to_csv(), "edited_df.csv", use_container_width=True
|
31 |
)
|
32 |
|
33 |
-
molecule = st.text_input("
|
34 |
smile_code = st_ketcher(molecule)
|
35 |
-
st.
|
|
|
|
|
36 |
|
37 |
-
try:
|
38 |
-
P = RF.main( str(smile_code ) )
|
39 |
-
st.markdown(f"⚡PCE predicted by RF: {P}")
|
40 |
-
except:
|
41 |
-
st.markdown(f"⚡PCE predicted by RF: None")
|
42 |
-
|
43 |
try:
|
44 |
pce = abcBERT.main( str(smile_code ) )
|
45 |
-
st.
|
46 |
except:
|
47 |
-
st.
|
48 |
|
|
|
6 |
from streamlit_ketcher import st_ketcher
|
7 |
import abcBERT
|
8 |
import RF
|
9 |
+
from streamlit_gsheets import GSheetsConnection
|
10 |
+
|
11 |
# Page setup
|
12 |
st.set_page_config(page_title="DeepAcceptor", page_icon="🔋", layout="wide")
|
13 |
st.title("🔋DeepAcceptor")
|
14 |
|
15 |
# Connect to the Google Sheet
|
16 |
+
url1 = r"https://docs.google.com/spreadsheets/d/1YOEIg0nMTSPkAOr8wkqxQRLuUhys3-J0I-KPEpmzPLw/gviz/tq?tqx=out:csv&sheet=accept"
|
17 |
+
url = r"https://docs.google.com/spreadsheets/d/1YOEIg0nMTSPkAOr8wkqxQRLuUhys3-J0I-KPEpmzPLw/gviz/tq?tqx=out:csv&sheet=111"
|
18 |
df1 = pd.read_csv(url1, dtype=str, encoding='utf-8')
|
19 |
+
col1, col2 = st.columns(2)
|
20 |
+
with col1:
|
21 |
+
|
22 |
+
text_search = st.text_input("🔍**Search papers or molecules**", value="")
|
23 |
+
m1 = df1["name"].str.contains(text_search)
|
24 |
+
m2 = df1["reference"].str.contains(text_search)
|
25 |
+
df_search = df1[m1 | m2]
|
26 |
+
with col2:
|
27 |
if text_search:
|
28 |
+
st.link_button("📝**DATABASE**", r"https://docs.google.com/spreadsheets/d/1YOEIg0nMTSPkAOr8wkqxQRLuUhys3-J0I-KPEpmzPLw")
|
29 |
+
st.caption('👆If you want to update the database, click the button.')
|
30 |
st.write(df_search)
|
31 |
st.download_button( "⬇️ Download edited files as .csv", df_search.to_csv(), "df_search.csv", use_container_width=True)
|
32 |
edited_df = st.data_editor(df1, num_rows="dynamic")
|
33 |
+
edited_df.to_csv(url)
|
34 |
st.download_button(
|
35 |
"⬇️ Download edited files as .csv", edited_df.to_csv(), "edited_df.csv", use_container_width=True
|
36 |
)
|
37 |
|
38 |
+
molecule = st.text_input("📋**Molecule**")
|
39 |
smile_code = st_ketcher(molecule)
|
40 |
+
st.subheader(f"✨**Smiles code**: {smile_code}")
|
41 |
+
P = RF.main( str(smile_code ) )
|
42 |
+
st.header(f":blue[⚡**PCE predicted by RF**]: {P}")
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
try:
|
45 |
pce = abcBERT.main( str(smile_code ) )
|
46 |
+
st.header(f":blue[⚡**PCE predicted by abcBERT**]: {pce}")
|
47 |
except:
|
48 |
+
st.header(f":blue[⚡**PCE predicted by abcBERT**]: :red["Running"]")
|
49 |
|