Spaces:
Running
Running
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- coding: utf-8 -*-
|
2 |
+
import streamlit as st
|
3 |
+
import pandas as pd
|
4 |
+
import rdkit
|
5 |
+
import streamlit_ketcher
|
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 |
+
|
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 |
+
if text_search:
|
31 |
+
st.write(df_search)
|
32 |
+
st.download_button( "⬇️ Download edited files as .csv", df_search.to_csv(), "df_search.csv", use_container_width=True)
|
33 |
+
edited_df = st.data_editor(df1, num_rows="dynamic")
|
34 |
+
edited_df.to_csv(url)
|
35 |
+
st.download_button(
|
36 |
+
"⬇️ Download edited files as .csv", edited_df.to_csv(), "edited_df.csv", use_container_width=True
|
37 |
+
)
|
38 |
+
|
39 |
+
molecule = st.text_input("📋**Molecule**")
|
40 |
+
smile_code = st_ketcher(molecule)
|
41 |
+
st.subheader(f"✨**Smiles code**: {smile_code}")
|
42 |
+
P = RF.main( str(smile_code ) )
|
43 |
+
st.header(f":blue[⚡**PCE predicted by RF**]: {P}")
|
44 |
+
|
45 |
+
try:
|
46 |
+
pce = abcBERT.main( str(smile_code ) )
|
47 |
+
st.header(f":blue[⚡**PCE predicted by abcBERT**]: {pce}")
|
48 |
+
except:
|
49 |
+
st.header(f":blue[⚡**PCE predicted by abcBERT**]: :red["Running"]")
|
50 |
+
|