BiBERTa / app.py
jinysun's picture
Upload 17 files
ecdea35
raw
history blame
2.04 kB
import streamlit as st
import pandas as pd
import rdkit
import streamlit_ketcher
from streamlit_ketcher import st_ketcher
import run
# Page setup
st.set_page_config(page_title="DeepDAP", page_icon="🔋", layout="wide")
st.title("🔋DeepDAP")
# Connect to the Google Sheet
url1= r"https://docs.google.com/spreadsheets/d/1AKkZS04VF3osFT36aNHIb4iUbV8D1uNfsldcpHXogj0/gviz/tq?tqx=out:csv&sheet=dap"
df1 = pd.read_csv(url1, dtype=str, encoding='utf-8')
col1, col2 = st.columns(2)
with col1:
text_search = st.text_input("🔍Search papers or molecules", value="")
m1 = df1["Donor_Name"].str.contains(text_search)
m2 = df1["reference"].str.contains(text_search)
m3 = df1["Acceptor_Name"].str.contains(text_search)
df_search = df1[m1 | m2|m3]
with col2:
st.link_button("📝Database", r"https://docs.google.com/spreadsheets/d/1AKkZS04VF3osFT36aNHIb4iUbV8D1uNfsldcpHXogj0")
st.caption('🎉If you want to update the database, click the button.')
if text_search:
st.write(df_search)
st.download_button( "⬇️Download edited files as .csv", df_search.to_csv(), "df_search.csv", use_container_width=True)
edited_df = st.data_editor(df1, num_rows="dynamic")
st.download_button(
"⬇️ Download edited files as .csv", edited_df.to_csv(), "edited_df.csv", use_container_width=True
)
option = st.selectbox(
"How would you like to be contacted?",
("Donor", "Acceptor"), placeholder="Select the type of active layer..."
)
if option == 'Acceptor':
molecule = st.text_input("👨‍🔬Acceptor Molecule" )
acceptor= st_ketcher(molecule )
st.markdown(f"🏆New SMILES of edited acceptor molecules: {acceptor}")
donor= st.text_input("📋 Donor Molecule")
if option =='Donor':
do= st.text_input("👨‍🔬Donor Molecule" )
donor = st_ketcher(do)
st.markdown(f"🏆New SMILES of edited donor molecules: {donor}")
acceptor = st.text_input("📋 Acceptor Molecule")
try:
pce = run.smiles_aas_test( str(acceptor ), str(donor) )
st.markdown(f"⚡PCE: ``{pce}``")
except:
st.markdown(f"⚡PCE: None ")