import streamlit as st import pandas as pd import rdkit import streamlit_ketcher from streamlit_ketcher import st_ketcher import run import screen # Page setup st.set_page_config(page_title="DeepDAP", page_icon="🔋", layout="wide") st.title("🔋DeepDAP") st.subheader('',divider='rainbow') # 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: st.header("🔍**Search papers or molecules**") text_search = st.text_input(label="_", value="",label_visibility="hidden" ) 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(":black[📝**DATABASE**]", r"https://docs.google.com/spreadsheets/d/1AKkZS04VF3osFT36aNHIb4iUbV8D1uNfsldcpHXogj0") st.caption(':black[👆If you want to update the origin 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 ) st.subheader("👇 :red[***Select the type of active layer...***]") option = st.radio( "👇 :red[**Select the type of active layer...**]", [":black[**Donor**]", ":black[**Acceptor**]"], label_visibility="hidden" ) if option ==":black[**Acceptor**]": st.subheader("👨‍🔬**Input the SMILES of Acceptor Molecule**") molecule = st.text_input("👨‍🔬**Input the SMILES of Acceptor Molecule**", label_visibility="hidden" ) acceptor= st_ketcher(molecule ) st.subheader(f"🏆**New SMILES of edited acceptor molecules**: {acceptor}") st.subheader(":black[**🧡Input the SMILES of Donor Molecule**]") donor= st.text_input(":black[**🧡Input the SMILES of Donor Molecule**]", label_visibility="hidden") if option ==":black[**Donor**]": st.subheader("👨‍🔬**Input the SMILES of Donor Molecule**" ) do= st.text_input("👨‍🔬**Input the SMILES of Donor Molecule**" , label_visibility="hidden") donor = st_ketcher(do) st.subheader(f"🏆**New SMILES of edited donor molecules**: {donor}") st.subheader(":black[**🧡Input the SMILES of Acceptor Molecule**]") acceptor = st.text_input(":black[**🧡Input the SMILES of Acceptor Molecule**]", label_visibility="hidden") try: pce = run.smiles_aas_test( str(acceptor ), str(donor) ) st.subheader(f"⚡**PCE**: ``{pce}``") except: st.subheader(f"⚡**PCE**: None ") st.subheader(":black[**🧡Batch screening for high-performance D/A pairs**]") uploaded_files = st.file_uploader("Choose a CSV file") st.write( "🎈upload a csv file containing ['donor' ] and ['acceptor']") if st.button("📑PREDICT"): if uploaded_files is not None: text = st.markdown(":red[Predictions are being made... Please wait...]") st.progress(100, text=None) x = screen.smiles_aas_test(uploaded_files ) x = pd.DataFrame(x) st.download_button( "⬇️Download the predicted files as .csv", x.to_csv(), "predict results.csv", use_container_width=True) else: st.markdown(":red[Please upload the file first!]")