Spaces:
No application file
No application file
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import rdkit
|
4 |
+
import streamlit_ketcher
|
5 |
+
from streamlit_ketcher import st_ketcher
|
6 |
+
import abcBERT
|
7 |
+
|
8 |
+
# Page setup
|
9 |
+
st.set_page_config(page_title="DeepAcceptor", page_icon="🔋", layout="wide")
|
10 |
+
st.title("DeepAcceptor")
|
11 |
+
|
12 |
+
# Connect to the Google Sheet
|
13 |
+
url1 = r"https://docs.google.com/spreadsheets/d/1YOEIg0nMTSPkAOr8wkqxQRLuUhys3-J0I-KPEpmzPLw/gviz/tq?tqx=out:csv&sheet=accept"
|
14 |
+
url = r"https://docs.google.com/spreadsheets/d/1YOEIg0nMTSPkAOr8wkqxQRLuUhys3-J0I-KPEpmzPLw/gviz/tq?tqx=out:csv&sheet=111"
|
15 |
+
df1 = pd.read_csv(url1, dtype=str, encoding='utf-8')
|
16 |
+
|
17 |
+
text_search = st.text_input("Search papers or molecules", value="")
|
18 |
+
m1 = df1["name"].str.contains(text_search)
|
19 |
+
m2 = df1["reference"].str.contains(text_search)
|
20 |
+
df_search = df1[m1 | m2]
|
21 |
+
if text_search:
|
22 |
+
st.write(df_search)
|
23 |
+
st.download_button( "Download edited files as .csv", df_search.to_csv(), "df_search.csv", use_container_width=True)
|
24 |
+
edited_df = st.data_editor(df1, num_rows="dynamic")
|
25 |
+
edited_df.to_csv(url)
|
26 |
+
st.download_button(
|
27 |
+
"⬇️ Download edited files as .csv", edited_df.to_csv(), "edited_df.csv", use_container_width=True
|
28 |
+
)
|
29 |
+
|
30 |
+
molecule = st.text_input("Molecule")
|
31 |
+
smile_code = st_ketcher(molecule)
|
32 |
+
st.markdown(f"Smile code: ``{smile_code}``")
|
33 |
+
try:
|
34 |
+
pce = abcBERT.main( str(smile_code ) )
|
35 |
+
st.markdown(f"PCE: ``{pce}``")
|
36 |
+
except:
|
37 |
+
st.markdown(f"PCE: None ")
|