Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -171,7 +171,8 @@ def run_inference(mode: str, model_name: str, num_molecules: int, seed_num: str,
|
|
| 171 |
|
| 172 |
|
| 173 |
with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
| 174 |
-
|
|
|
|
| 175 |
# Add custom CSS for styling
|
| 176 |
gr.HTML("""
|
| 177 |
<style>
|
|
@@ -220,47 +221,47 @@ with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
|
| 220 |
|
| 221 |
with gr.Accordion("About DrugGEN Models", open=False):
|
| 222 |
gr.Markdown("""
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
""")
|
| 237 |
|
| 238 |
with gr.Accordion("Understanding the Metrics", open=False):
|
| 239 |
gr.Markdown("""
|
| 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 |
with gr.Row():
|
|
@@ -274,7 +275,6 @@ with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
|
| 274 |
# Use Gradio Tabs to separate the two modes.
|
| 275 |
with gr.Tabs():
|
| 276 |
with gr.TabItem("Classical Generation"):
|
| 277 |
-
with gr.Row():
|
| 278 |
num_molecules = gr.Slider(
|
| 279 |
minimum=10,
|
| 280 |
maximum=200,
|
|
@@ -296,19 +296,20 @@ with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
|
| 296 |
size="lg"
|
| 297 |
)
|
| 298 |
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
|
|
|
| 312 |
|
| 313 |
with gr.Column(scale=2):
|
| 314 |
basic_metrics_df = gr.Dataframe(
|
|
@@ -326,7 +327,7 @@ with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
|
| 326 |
image_output = gr.Image(label="Structures of Randomly Selected Generated Molecules",
|
| 327 |
elem_id="molecule_display")
|
| 328 |
|
| 329 |
-
|
| 330 |
|
| 331 |
# Set up the click actions for each tab.
|
| 332 |
classical_submit.click(
|
|
|
|
| 171 |
|
| 172 |
|
| 173 |
with gr.Blocks(theme=gr.themes.Ocean()) as demo:
|
| 174 |
+
|
| 175 |
+
with gr.Column(scale=1):
|
| 176 |
# Add custom CSS for styling
|
| 177 |
gr.HTML("""
|
| 178 |
<style>
|
|
|
|
| 221 |
|
| 222 |
with gr.Accordion("About DrugGEN Models", open=False):
|
| 223 |
gr.Markdown("""
|
| 224 |
+
## Model Variations
|
| 225 |
+
|
| 226 |
+
### DrugGEN-AKT1
|
| 227 |
+
This model is designed to generate molecules targeting the human AKT1 protein (UniProt ID: P31749).
|
| 228 |
+
|
| 229 |
+
### DrugGEN-CDK2
|
| 230 |
+
This model is designed to generate molecules targeting the human CDK2 protein (UniProt ID: P24941).
|
| 231 |
+
|
| 232 |
+
### DrugGEN-NoTarget
|
| 233 |
+
This is a general-purpose model that generates diverse drug-like molecules without targeting a specific protein.
|
| 234 |
+
- Useful for exploring chemical space, generating diverse scaffolds, and creating molecules with drug-like properties.
|
| 235 |
+
|
| 236 |
+
For more details, see our [paper on arXiv](https://arxiv.org/abs/2302.07868).
|
| 237 |
""")
|
| 238 |
|
| 239 |
with gr.Accordion("Understanding the Metrics", open=False):
|
| 240 |
gr.Markdown("""
|
| 241 |
+
## Evaluation Metrics
|
| 242 |
+
|
| 243 |
+
### Basic Metrics
|
| 244 |
+
- **Validity**: Percentage of generated molecules that are chemically valid
|
| 245 |
+
- **Uniqueness**: Percentage of unique molecules among valid ones
|
| 246 |
+
- **Runtime**: Time taken to generate or evaluate the molecules
|
| 247 |
+
|
| 248 |
+
### Novelty Metrics
|
| 249 |
+
- **Novelty (Train)**: Percentage of molecules not found in the training set
|
| 250 |
+
- **Novelty (Inference)**: Percentage of molecules not found in the test set
|
| 251 |
+
- **Novelty (Real Inhibitors)**: Percentage of molecules not found in known inhibitors of the target protein
|
| 252 |
+
|
| 253 |
+
### Structural Metrics
|
| 254 |
+
- **Average Length**: Average component length in the generated molecules
|
| 255 |
+
- **Mean Atom Type**: Average distribution of atom types
|
| 256 |
+
- **Internal Diversity**: Diversity within the generated set (higher is more diverse)
|
| 257 |
+
|
| 258 |
+
### Drug-likeness Metrics
|
| 259 |
+
- **QED (Quantitative Estimate of Drug-likeness)**: Score from 0-1 measuring how drug-like a molecule is (higher is better)
|
| 260 |
+
- **SA Score (Synthetic Accessibility)**: Score from 1-10 indicating ease of synthesis (lower is better)
|
| 261 |
+
|
| 262 |
+
### Similarity Metrics
|
| 263 |
+
- **SNN ChEMBL**: Similarity to ChEMBL molecules (higher means more similar to known drug-like compounds)
|
| 264 |
+
- **SNN Real Inhibitors**: Similarity to known drugs (higher means more similar to approved drugs)
|
| 265 |
""")
|
| 266 |
|
| 267 |
with gr.Row():
|
|
|
|
| 275 |
# Use Gradio Tabs to separate the two modes.
|
| 276 |
with gr.Tabs():
|
| 277 |
with gr.TabItem("Classical Generation"):
|
|
|
|
| 278 |
num_molecules = gr.Slider(
|
| 279 |
minimum=10,
|
| 280 |
maximum=200,
|
|
|
|
| 296 |
size="lg"
|
| 297 |
)
|
| 298 |
|
| 299 |
+
with gr.TabItem("Custom Input SMILES"):
|
| 300 |
+
custom_smiles = gr.Textbox(
|
| 301 |
+
label="Input SMILES (one per line, maximum 100 molecules)",
|
| 302 |
+
placeholder="C(C(=O)O)N\nCCO\n...",
|
| 303 |
+
lines=10
|
| 304 |
+
)
|
| 305 |
+
|
| 306 |
+
custom_submit = gr.Button(
|
| 307 |
+
value="Generate Molecules using Custom SMILES",
|
| 308 |
+
variant="primary",
|
| 309 |
+
size="lg"
|
| 310 |
+
)
|
| 311 |
+
|
| 312 |
+
gr.Markdown("### Created by the HUBioDataLab | [GitHub](https://github.com/HUBioDataLab/DrugGEN) | [Paper](https://arxiv.org/abs/2302.07868)")
|
| 313 |
|
| 314 |
with gr.Column(scale=2):
|
| 315 |
basic_metrics_df = gr.Dataframe(
|
|
|
|
| 327 |
image_output = gr.Image(label="Structures of Randomly Selected Generated Molecules",
|
| 328 |
elem_id="molecule_display")
|
| 329 |
|
| 330 |
+
|
| 331 |
|
| 332 |
# Set up the click actions for each tab.
|
| 333 |
classical_submit.click(
|