File size: 8,291 Bytes
43e7ae4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
"""
Configuration Settings Module
This module contains configuration settings and constants
for the drug discovery application.
"""
# Drug discovery molecules
DRUG_SMILES = [
"CC1=CC=C(C=C1)C(C)NC(=O)C2=CC=C(C=C2)Cl", # Ibuprofen
"CC1=CC=C(C=C1)C(C)NC(=O)C2=CC=C(C=C2)F", # Flurbiprofen
"CC1=CC=C(C=C1)C(C)NC(=O)C2=CC=C(C=C2)Br", # Bromfenac
"CC1=CC=C(C=C1)C(C)NC(=O)C2=CC=C(C=C2)I", # Iodofenac
"CC1=CC=C(C=C1)C(C)NC(=O)C2=CC=C(C=C2)[N+](=O)[O-]", # Nitrofenac
]
# Common drug discovery molecules
COMMON_SMILES = [
"C[C@H](N)C(=O)O", # Alanine (amino acid)
"CC(=O)OC1=CC=CC=C1C(=O)O", # Aspirin (NSAID)
"CCN(CC)CC", # Triethylamine (base)
"c1ccccc1O", # Phenol (aromatic)
"CC(C)CC(=O)O", # Valeric acid (fatty acid)
"CN1C=NC2=C1N=CN2", # Adenine (nucleobase)
"O=C(O)C1=CC=CC=C1", # Benzoic acid (aromatic acid)
"C1CCCCC1", # Cyclohexane (cycloalkane)
"CC(=O)N1CCCCC1", # N-methylpiperidine (amine)
]
# AI Model Configuration
AI_MODEL = "openai/gpt-oss-20b"
AI_MAX_TOKENS = 512
AI_TEMPERATURE = 0.7
AI_TOP_P = 0.9
# UI Configuration
DEFAULT_SMILES = "C[C@H](N)C(=O)O" # Alanine
DEFAULT_VARIATIONS_COUNT = 12
DEFAULT_GRID_COLUMNS = 4
MAX_GRID_COLUMNS = 8
MIN_VARIATIONS = 6
MAX_VARIATIONS = 24
# Image Configuration
MOLECULE_IMAGE_SIZE = (300, 300)
PREVIEW_IMAGE_SIZE = (200, 200)
GALLERY_IMAGE_SIZE = (200, 200)
VARIATION_IMAGE_SIZES = [(150, 150), (180, 180), (200, 200), (160, 160)]
# CSS Styling
CUSTOM_CSS = """
/* Full width layout */
.gradio-container {
max-width: 100% !important;
width: 100% !important;
}
.gradio-container .container {
max-width: 100% !important;
width: 100% !important;
}
/* Ensure rows use full width */
.gr-row {
width: 100% !important;
max-width: 100% !important;
}
.gr-column {
width: 100% !important;
max-width: 100% !important;
}
/* Make images responsive to zoom */
.gr-image {
width: 100% !important;
height: auto !important;
max-width: 100% !important;
object-fit: contain !important;
}
/* Responsive text scaling */
.gr-markdown {
width: 100% !important;
max-width: 100% !important;
word-wrap: break-word !important;
overflow-wrap: break-word !important;
}
/* Left column spacing */
.gr-column:first-child {
padding-right: 20px;
min-width: 300px;
}
/* Right column spacing */
.gr-column:last-child {
padding-left: 20px;
min-width: 400px;
}
#main_structure {
border: none;
border-radius: 12px;
background: transparent;
width: 100%;
max-width: 100%;
height: auto;
max-height: 350px;
overflow: hidden;
object-fit: contain;
margin: 5px 0;
/* Make responsive to zoom */
min-height: 200px;
resize: both;
}
/* Seamless properties display */
.seamless-properties {
background: transparent;
border: none;
padding: 8px 0;
margin: 5px 0;
font-size: 13px;
color: #e2e8f0;
text-align: left;
line-height: 1.4;
/* Make responsive to zoom */
width: 100%;
max-width: 100%;
overflow-wrap: break-word;
word-wrap: break-word;
}
.seamless-properties h1, .seamless-properties h2, .seamless-properties h3 {
margin: 0 0 8px 0;
color: #f7fafc;
font-weight: bold;
}
.seamless-properties p {
margin: 4px 0;
color: #e2e8f0;
}
.seamless-properties ul {
margin: 4px 0;
padding-left: 20px;
color: #e2e8f0;
}
.seamless-properties li {
color: #e2e8f0;
}
.seamless-properties strong {
color: #f7fafc;
font-weight: bold;
}
.seamless-properties em {
color: #a0aec0;
font-style: italic;
}
#variations_gallery {
border: none;
border-radius: 12px;
background: transparent;
max-height: 300px;
overflow-y: auto;
margin: 5px 0;
}
#variations_container {
margin-top: 5px;
}
#variations_gallery .gallery-item {
border: 1px solid #4a5568;
border-radius: 8px;
margin: 3px;
transition: all 0.3s ease;
background: #1a202c;
/* Better aspect ratio for chemical structures */
aspect-ratio: 1.3 / 1;
min-width: 200px;
max-width: 250px;
}
#variations_gallery .gallery-item:hover {
border-color: #68d391;
transform: scale(1.05);
box-shadow: 0 4px 12px rgba(104, 211, 145, 0.3);
background: #2d3748;
}
/* Ensure images fill the wider cells properly */
#variations_gallery .gallery-item img {
width: 100%;
height: 100%;
object-fit: contain;
border-radius: 6px;
}
#variations_container {
max-height: 600px;
overflow-y: auto;
padding: 10px;
}
#selected_smiles, #selected_style {
background: #f5f5f5;
border: 1px solid #ddd;
border-radius: 5px;
}
.page-info {
text-align: center;
font-weight: bold;
color: #666;
}
.grid-controls {
background: #f0f0f0;
padding: 10px;
border-radius: 8px;
margin: 10px 0;
}
/* Compact properties display */
.compact-properties {
background: #2d3748;
border: 1px solid #4a5568;
border-radius: 8px;
padding: 15px;
margin: 10px 0;
font-size: 13px;
color: #e2e8f0 !important;
text-align: left;
min-height: 60px;
max-height: 200px;
overflow-y: auto;
line-height: 1.4;
}
.compact-properties h1, .compact-properties h2, .compact-properties h3 {
margin: 0 0 8px 0;
color: #f7fafc !important;
font-weight: bold;
}
.compact-properties p {
margin: 4px 0;
color: #e2e8f0 !important;
}
.compact-properties ul {
margin: 4px 0;
padding-left: 20px;
color: #e2e8f0 !important;
}
.compact-properties li {
color: #e2e8f0 !important;
}
.compact-properties strong {
color: #f7fafc !important;
font-weight: bold;
}
.compact-properties em {
color: #a0aec0 !important;
font-style: italic;
}
/* Force text visibility - override any conflicting styles */
.compact-properties * {
color: #e2e8f0 !important;
}
.compact-properties h1, .compact-properties h2, .compact-properties h3, .compact-properties strong {
color: #f7fafc !important;
}
/* Ensure markdown content is visible */
.compact-properties .markdown {
color: #e2e8f0 !important;
}
.compact-properties .markdown h1, .compact-properties .markdown h2, .compact-properties .markdown h3 {
color: #f7fafc !important;
}
.compact-properties .markdown strong {
color: #f7fafc !important;
}
/* Popup notification system */
.notification-popup {
position: fixed;
top: 20px;
right: 20px;
background: #2d3748;
color: #e2e8f0;
padding: 12px 20px;
border-radius: 8px;
border-left: 4px solid #68d391;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
z-index: 1000;
font-size: 14px;
font-weight: 500;
max-width: 300px;
opacity: 0;
transform: translateX(100%);
transition: all 0.3s ease-in-out;
}
.notification-popup.show {
opacity: 1;
transform: translateX(0);
}
.notification-popup.error {
border-left-color: #f56565;
}
.notification-popup.warning {
border-left-color: #ed8936;
}
.notification-popup.info {
border-left-color: #4299e1;
}
/* Success notification */
.notification-popup.success {
border-left-color: #68d391;
}
/* Auto-hide animation */
.notification-popup.auto-hide {
animation: slideOut 0.3s ease-in-out 2.5s forwards;
}
@keyframes slideOut {
to {
opacity: 0;
transform: translateX(100%);
}
}
/* Spacer styling */
.spacer {
margin: 20px 0;
opacity: 0.3;
}
/* Notification container */
#notification-container {
position: fixed;
top: 20px;
right: 20px;
z-index: 1000;
pointer-events: none;
}
/* Temporary notification display */
.temp-notification {
background: #2d3748;
color: #e2e8f0;
padding: 12px 20px;
border-radius: 8px;
border-left: 4px solid #68d391;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
margin-bottom: 10px;
font-size: 14px;
font-weight: 500;
max-width: 300px;
opacity: 1;
transform: translateX(0);
transition: all 0.3s ease-in-out;
pointer-events: auto;
}
.temp-notification.error {
border-left-color: #f56565;
}
.temp-notification.warning {
border-left-color: #ed8936;
}
.temp-notification.info {
border-left-color: #4299e1;
}
.temp-notification.success {
border-left-color: #68d391;
}
"""
|