Joey / src /config /settings.py
Joey Callanan
Creating new Space
43e7ae4
"""
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;
}
"""