Update app.py
Browse files
app.py
CHANGED
|
@@ -17,7 +17,6 @@ import matplotlib.pyplot as plt
|
|
| 17 |
import matplotlib.patches as mpatches
|
| 18 |
|
| 19 |
import streamlit as st
|
| 20 |
-
import streamlit.components.v1 as components
|
| 21 |
|
| 22 |
# Optional RDKit logging mute
|
| 23 |
try:
|
|
@@ -85,39 +84,38 @@ else:
|
|
| 85 |
}
|
| 86 |
"""
|
| 87 |
|
| 88 |
-
|
|
|
|
| 89 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 90 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 91 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
| 92 |
<style>
|
| 93 |
/* Hide Streamlit elements */
|
| 94 |
-
#MainMenu, footer, header {
|
| 95 |
-
.stDeployButton, [data-testid="stToolbar"] {
|
| 96 |
-
[data-testid="collapsedControl"] {
|
| 97 |
-
section[data-testid="stSidebar"] {
|
| 98 |
-
|
| 99 |
-
{
|
| 100 |
-
|
| 101 |
-
.stApp {{
|
| 102 |
background: var(--bg) !important;
|
| 103 |
font-family: var(--font-sans) !important;
|
| 104 |
color: var(--text) !important;
|
| 105 |
-
}
|
| 106 |
|
| 107 |
/* Center and constrain main block */
|
| 108 |
-
.main .block-container {
|
| 109 |
max-width: 1160px !important;
|
| 110 |
margin: 0 auto !important;
|
| 111 |
padding: 0 32px 80px !important;
|
| 112 |
-
}
|
| 113 |
|
| 114 |
/* Tabs */
|
| 115 |
-
.stTabs [data-baseweb="tab-list"] {
|
| 116 |
background: transparent !important;
|
| 117 |
border-bottom: 1px solid var(--border) !important;
|
| 118 |
gap: 0 !important; padding: 0 !important;
|
| 119 |
-
}
|
| 120 |
-
.stTabs [data-baseweb="tab"] {
|
| 121 |
background: transparent !important;
|
| 122 |
color: var(--muted) !important;
|
| 123 |
font-family: var(--font-sans) !important;
|
|
@@ -126,18 +124,18 @@ section[data-testid="stSidebar"] {{ display: none !important; }}
|
|
| 126 |
border: none !important;
|
| 127 |
border-bottom: 2px solid transparent !important;
|
| 128 |
border-radius: 0 !important;
|
| 129 |
-
}
|
| 130 |
-
.stTabs [aria-selected="true"] {
|
| 131 |
color: var(--accent) !important;
|
| 132 |
border-bottom-color: var(--accent) !important;
|
| 133 |
background: transparent !important;
|
| 134 |
-
}
|
| 135 |
-
.stTabs [data-baseweb="tab-highlight"] {
|
| 136 |
-
.stTabs [data-baseweb="tab-border"] {
|
| 137 |
-
.stTabs [data-baseweb="tab-panel"] {
|
| 138 |
|
| 139 |
/* Textarea & Input */
|
| 140 |
-
.stTextArea textarea, .stTextInput input {
|
| 141 |
background: var(--surface) !important;
|
| 142 |
border: 1px solid var(--border) !important;
|
| 143 |
border-radius: 6px !important;
|
|
@@ -145,29 +143,29 @@ section[data-testid="stSidebar"] {{ display: none !important; }}
|
|
| 145 |
font-family: var(--font-mono) !important;
|
| 146 |
font-size: 13px !important;
|
| 147 |
line-height: 1.6 !important;
|
| 148 |
-
}
|
| 149 |
-
.stTextArea textarea:focus, .stTextInput input:focus {
|
| 150 |
border-color: var(--accent) !important;
|
| 151 |
box-shadow: 0 0 0 2px var(--accent-dim) !important;
|
| 152 |
-
}
|
| 153 |
-
.stTextArea label, .stTextInput label {
|
| 154 |
color: var(--muted) !important;
|
| 155 |
font-family: var(--font-sans) !important;
|
| 156 |
font-size: 12px !important; font-weight: 500 !important;
|
| 157 |
-
}
|
| 158 |
|
| 159 |
/* File uploader */
|
| 160 |
-
[data-testid="stFileUploader"] {
|
| 161 |
background: var(--surface) !important;
|
| 162 |
border: 2px dashed var(--border) !important;
|
| 163 |
border-radius: 8px !important;
|
| 164 |
-
}
|
| 165 |
[data-testid="stFileUploader"] label,
|
| 166 |
-
[data-testid="stFileUploader"] span {
|
| 167 |
-
[data-testid="stFileUploaderDropzone"] {
|
| 168 |
|
| 169 |
/* Buttons */
|
| 170 |
-
.stButton button[kind="primary"] {
|
| 171 |
background: var(--accent) !important;
|
| 172 |
color: #ffffff !important;
|
| 173 |
border: none !important;
|
|
@@ -177,22 +175,22 @@ section[data-testid="stSidebar"] {{ display: none !important; }}
|
|
| 177 |
padding: 10px 24px !important;
|
| 178 |
width: 100% !important;
|
| 179 |
transition: opacity .15s !important;
|
| 180 |
-
}
|
| 181 |
-
.stButton button[kind="primary"]:hover {
|
| 182 |
|
| 183 |
/* Standard Buttons (like Theme Toggle) */
|
| 184 |
-
.stButton button[kind="secondary"] {
|
| 185 |
background: var(--surface) !important;
|
| 186 |
color: var(--text) !important;
|
| 187 |
border: 1px solid var(--border) !important;
|
| 188 |
border-radius: 6px !important;
|
| 189 |
font-family: var(--font-sans) !important;
|
| 190 |
font-size: 13px !important; font-weight: 500 !important;
|
| 191 |
-
}
|
| 192 |
-
.stButton button[kind="secondary"]:hover {
|
| 193 |
|
| 194 |
/* Pill buttons */
|
| 195 |
-
.pill-btn button {
|
| 196 |
background: var(--surface) !important;
|
| 197 |
color: var(--muted) !important;
|
| 198 |
border: 1px solid var(--border) !important;
|
|
@@ -201,36 +199,36 @@ section[data-testid="stSidebar"] {{ display: none !important; }}
|
|
| 201 |
font-size: 11.5px !important;
|
| 202 |
padding: 3px 10px !important;
|
| 203 |
width: auto !important;
|
| 204 |
-
}
|
| 205 |
-
.pill-btn button:hover {
|
| 206 |
|
| 207 |
/* Dataframe */
|
| 208 |
-
[data-testid="stDataFrame"] iframe {
|
| 209 |
-
.stDataFrame {
|
| 210 |
|
| 211 |
/* Progress bar */
|
| 212 |
-
.stProgress > div > div > div > div {
|
| 213 |
-
[data-testid="stProgressBarMessage"] {
|
| 214 |
|
| 215 |
/* Spinner */
|
| 216 |
-
.stSpinner > div {
|
| 217 |
-
[data-testid="stSpinnerMessage"] {
|
| 218 |
|
| 219 |
/* Alert/error */
|
| 220 |
-
[data-testid="stAlert"] {
|
| 221 |
background: var(--danger-dim) !important;
|
| 222 |
border: 1px solid var(--danger) !important;
|
| 223 |
border-radius: 6px !important;
|
| 224 |
color: var(--danger) !important;
|
| 225 |
font-family: var(--font-mono) !important;
|
| 226 |
-
}
|
| 227 |
|
| 228 |
-
hr {
|
| 229 |
</style>
|
| 230 |
"""
|
| 231 |
|
|
|
|
| 232 |
st.markdown(base_css, unsafe_allow_html=True)
|
| 233 |
-
components.html(base_css, height=0, scrolling=False)
|
| 234 |
|
| 235 |
# Constants / paths
|
| 236 |
MODEL_REPO = "ym59/velobind-models"
|
|
|
|
| 17 |
import matplotlib.patches as mpatches
|
| 18 |
|
| 19 |
import streamlit as st
|
|
|
|
| 20 |
|
| 21 |
# Optional RDKit logging mute
|
| 22 |
try:
|
|
|
|
| 84 |
}
|
| 85 |
"""
|
| 86 |
|
| 87 |
+
# Standard string concatenation to avoid f-string curly brace conflicts
|
| 88 |
+
base_css = """
|
| 89 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 90 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 91 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
| 92 |
<style>
|
| 93 |
/* Hide Streamlit elements */
|
| 94 |
+
#MainMenu, footer, header { visibility: hidden; }
|
| 95 |
+
.stDeployButton, [data-testid="stToolbar"] { display: none; }
|
| 96 |
+
[data-testid="collapsedControl"] { display: none !important; }
|
| 97 |
+
section[data-testid="stSidebar"] { display: none !important; }
|
| 98 |
+
""" + theme_css + """
|
| 99 |
+
.stApp {
|
|
|
|
|
|
|
| 100 |
background: var(--bg) !important;
|
| 101 |
font-family: var(--font-sans) !important;
|
| 102 |
color: var(--text) !important;
|
| 103 |
+
}
|
| 104 |
|
| 105 |
/* Center and constrain main block */
|
| 106 |
+
.main .block-container {
|
| 107 |
max-width: 1160px !important;
|
| 108 |
margin: 0 auto !important;
|
| 109 |
padding: 0 32px 80px !important;
|
| 110 |
+
}
|
| 111 |
|
| 112 |
/* Tabs */
|
| 113 |
+
.stTabs [data-baseweb="tab-list"] {
|
| 114 |
background: transparent !important;
|
| 115 |
border-bottom: 1px solid var(--border) !important;
|
| 116 |
gap: 0 !important; padding: 0 !important;
|
| 117 |
+
}
|
| 118 |
+
.stTabs [data-baseweb="tab"] {
|
| 119 |
background: transparent !important;
|
| 120 |
color: var(--muted) !important;
|
| 121 |
font-family: var(--font-sans) !important;
|
|
|
|
| 124 |
border: none !important;
|
| 125 |
border-bottom: 2px solid transparent !important;
|
| 126 |
border-radius: 0 !important;
|
| 127 |
+
}
|
| 128 |
+
.stTabs [aria-selected="true"] {
|
| 129 |
color: var(--accent) !important;
|
| 130 |
border-bottom-color: var(--accent) !important;
|
| 131 |
background: transparent !important;
|
| 132 |
+
}
|
| 133 |
+
.stTabs [data-baseweb="tab-highlight"] { background: var(--accent) !important; height: 2px !important; }
|
| 134 |
+
.stTabs [data-baseweb="tab-border"] { display: none !important; }
|
| 135 |
+
.stTabs [data-baseweb="tab-panel"] { padding: 24px 0 0 !important; background: transparent !important; }
|
| 136 |
|
| 137 |
/* Textarea & Input */
|
| 138 |
+
.stTextArea textarea, .stTextInput input {
|
| 139 |
background: var(--surface) !important;
|
| 140 |
border: 1px solid var(--border) !important;
|
| 141 |
border-radius: 6px !important;
|
|
|
|
| 143 |
font-family: var(--font-mono) !important;
|
| 144 |
font-size: 13px !important;
|
| 145 |
line-height: 1.6 !important;
|
| 146 |
+
}
|
| 147 |
+
.stTextArea textarea:focus, .stTextInput input:focus {
|
| 148 |
border-color: var(--accent) !important;
|
| 149 |
box-shadow: 0 0 0 2px var(--accent-dim) !important;
|
| 150 |
+
}
|
| 151 |
+
.stTextArea label, .stTextInput label {
|
| 152 |
color: var(--muted) !important;
|
| 153 |
font-family: var(--font-sans) !important;
|
| 154 |
font-size: 12px !important; font-weight: 500 !important;
|
| 155 |
+
}
|
| 156 |
|
| 157 |
/* File uploader */
|
| 158 |
+
[data-testid="stFileUploader"] {
|
| 159 |
background: var(--surface) !important;
|
| 160 |
border: 2px dashed var(--border) !important;
|
| 161 |
border-radius: 8px !important;
|
| 162 |
+
}
|
| 163 |
[data-testid="stFileUploader"] label,
|
| 164 |
+
[data-testid="stFileUploader"] span { color: var(--muted) !important; font-family: var(--font-sans) !important; }
|
| 165 |
+
[data-testid="stFileUploaderDropzone"] { background: transparent !important; }
|
| 166 |
|
| 167 |
/* Buttons */
|
| 168 |
+
.stButton button[kind="primary"] {
|
| 169 |
background: var(--accent) !important;
|
| 170 |
color: #ffffff !important;
|
| 171 |
border: none !important;
|
|
|
|
| 175 |
padding: 10px 24px !important;
|
| 176 |
width: 100% !important;
|
| 177 |
transition: opacity .15s !important;
|
| 178 |
+
}
|
| 179 |
+
.stButton button[kind="primary"]:hover { opacity: 0.90 !important; }
|
| 180 |
|
| 181 |
/* Standard Buttons (like Theme Toggle) */
|
| 182 |
+
.stButton button[kind="secondary"] {
|
| 183 |
background: var(--surface) !important;
|
| 184 |
color: var(--text) !important;
|
| 185 |
border: 1px solid var(--border) !important;
|
| 186 |
border-radius: 6px !important;
|
| 187 |
font-family: var(--font-sans) !important;
|
| 188 |
font-size: 13px !important; font-weight: 500 !important;
|
| 189 |
+
}
|
| 190 |
+
.stButton button[kind="secondary"]:hover { border-color: var(--accent) !important; color: var(--accent) !important; }
|
| 191 |
|
| 192 |
/* Pill buttons */
|
| 193 |
+
.pill-btn button {
|
| 194 |
background: var(--surface) !important;
|
| 195 |
color: var(--muted) !important;
|
| 196 |
border: 1px solid var(--border) !important;
|
|
|
|
| 199 |
font-size: 11.5px !important;
|
| 200 |
padding: 3px 10px !important;
|
| 201 |
width: auto !important;
|
| 202 |
+
}
|
| 203 |
+
.pill-btn button:hover { border-color: var(--accent) !important; color: var(--accent) !important; }
|
| 204 |
|
| 205 |
/* Dataframe */
|
| 206 |
+
[data-testid="stDataFrame"] iframe { background: var(--surface) !important; }
|
| 207 |
+
.stDataFrame { border: 1px solid var(--border) !important; border-radius: 8px !important; }
|
| 208 |
|
| 209 |
/* Progress bar */
|
| 210 |
+
.stProgress > div > div > div > div { background-color: var(--accent) !important; }
|
| 211 |
+
[data-testid="stProgressBarMessage"] { color: var(--muted) !important; font-family: var(--font-mono) !important; font-size: 11px !important; }
|
| 212 |
|
| 213 |
/* Spinner */
|
| 214 |
+
.stSpinner > div { border-top-color: var(--accent) !important; }
|
| 215 |
+
[data-testid="stSpinnerMessage"] { color: var(--muted) !important; font-family: var(--font-mono) !important; font-size: 12px !important; }
|
| 216 |
|
| 217 |
/* Alert/error */
|
| 218 |
+
[data-testid="stAlert"] {
|
| 219 |
background: var(--danger-dim) !important;
|
| 220 |
border: 1px solid var(--danger) !important;
|
| 221 |
border-radius: 6px !important;
|
| 222 |
color: var(--danger) !important;
|
| 223 |
font-family: var(--font-mono) !important;
|
| 224 |
+
}
|
| 225 |
|
| 226 |
+
hr { border: none !important; border-top: 1px solid var(--border) !important; margin: 20px 0 !important; }
|
| 227 |
</style>
|
| 228 |
"""
|
| 229 |
|
| 230 |
+
# Inject the clean CSS directly into the app
|
| 231 |
st.markdown(base_css, unsafe_allow_html=True)
|
|
|
|
| 232 |
|
| 233 |
# Constants / paths
|
| 234 |
MODEL_REPO = "ym59/velobind-models"
|