Upload 3 files
Browse files
Home.py
CHANGED
|
@@ -13,34 +13,51 @@ logo_data_uri = ""
|
|
| 13 |
if logo_path.exists():
|
| 14 |
logo_data_uri = "data:image/png;base64," + base64.b64encode(logo_path.read_bytes()).decode("ascii")
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
| 20 |
)
|
| 21 |
|
| 22 |
st.markdown(
|
| 23 |
f"""
|
| 24 |
-
<
|
| 25 |
-
<div
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
</div>
|
| 30 |
</div>
|
| 31 |
-
</
|
| 32 |
""",
|
| 33 |
unsafe_allow_html=True,
|
| 34 |
)
|
| 35 |
|
| 36 |
-
|
| 37 |
-
"""
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
"""
|
|
|
|
|
|
|
| 43 |
)
|
|
|
|
| 44 |
|
| 45 |
st.divider()
|
| 46 |
st.markdown("### Platform Modules")
|
|
@@ -93,28 +110,44 @@ cards = [
|
|
| 93 |
]
|
| 94 |
|
| 95 |
for i, (title, desc, page_path) in enumerate(cards, start=1):
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
st.divider()
|
| 107 |
-
st.markdown("**Developed by**")
|
| 108 |
-
st.markdown("### MONSTER Lab")
|
| 109 |
-
st.markdown("**Molecular/Nano-Scale Transport & Energy Research Laboratory**")
|
| 110 |
-
st.markdown("**College of Engineering, University of Notre Dame**")
|
| 111 |
st.markdown(
|
| 112 |
-
"
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
"
|
| 117 |
-
|
| 118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
)
|
| 120 |
-
st.markdown("[Visit MONSTER Lab Website](https://monsterlab.nd.edu/)")
|
|
|
|
| 13 |
if logo_path.exists():
|
| 14 |
logo_data_uri = "data:image/png;base64," + base64.b64encode(logo_path.read_bytes()).decode("ascii")
|
| 15 |
|
| 16 |
+
st.markdown(
|
| 17 |
+
"""
|
| 18 |
+
<div style="margin: 0.15rem 0 0.4rem 0;">
|
| 19 |
+
<span class="pp-badge">Home</span>
|
| 20 |
+
</div>
|
| 21 |
+
""",
|
| 22 |
+
unsafe_allow_html=True,
|
| 23 |
)
|
| 24 |
|
| 25 |
st.markdown(
|
| 26 |
f"""
|
| 27 |
+
<section class="pp-main-card">
|
| 28 |
+
<div class="pp-main-grid">
|
| 29 |
+
<div>
|
| 30 |
+
<h1 class="pp-main-title">Polymer Discovery Platform</h1>
|
| 31 |
+
<p class="pp-main-copy">
|
| 32 |
+
A unified platform for polymer research that combines property prediction, molecular visualization, and objective-driven candidate discovery to support faster, data-backed screening and selection decisions.
|
| 33 |
+
</p>
|
| 34 |
+
</div>
|
| 35 |
+
<div class="pp-main-logo">
|
| 36 |
+
{"<img src='" + logo_data_uri + "' alt='Platform logo' />" if logo_data_uri else ""}
|
| 37 |
</div>
|
| 38 |
</div>
|
| 39 |
+
</section>
|
| 40 |
""",
|
| 41 |
unsafe_allow_html=True,
|
| 42 |
)
|
| 43 |
|
| 44 |
+
stats = [
|
| 45 |
+
("25+", "Properties"),
|
| 46 |
+
("13K+", "Real Polymers"),
|
| 47 |
+
("1M", "Virtual Polymers"),
|
| 48 |
+
]
|
| 49 |
+
stats_html = "".join(
|
| 50 |
+
[
|
| 51 |
+
f"""
|
| 52 |
+
<div class="pp-kpi-item">
|
| 53 |
+
<p class="pp-kpi-value">{value}</p>
|
| 54 |
+
<p class="pp-kpi-label">{label}</p>
|
| 55 |
+
</div>
|
| 56 |
"""
|
| 57 |
+
for value, label in stats
|
| 58 |
+
]
|
| 59 |
)
|
| 60 |
+
st.markdown(f'<section class="pp-kpi-strip">{stats_html}</section>', unsafe_allow_html=True)
|
| 61 |
|
| 62 |
st.divider()
|
| 63 |
st.markdown("### Platform Modules")
|
|
|
|
| 110 |
]
|
| 111 |
|
| 112 |
for i, (title, desc, page_path) in enumerate(cards, start=1):
|
| 113 |
+
c1, c2 = st.columns([5, 1.1], vertical_alignment="center")
|
| 114 |
+
page_exists = (Path(__file__).resolve().parent / page_path).exists()
|
| 115 |
+
with c1:
|
| 116 |
+
st.markdown(
|
| 117 |
+
f"""
|
| 118 |
+
<div class="pp-module-card">
|
| 119 |
+
<p class="pp-module-title">{title}</p>
|
| 120 |
+
<p class="pp-module-copy">{desc}</p>
|
| 121 |
+
</div>
|
| 122 |
+
""",
|
| 123 |
+
unsafe_allow_html=True,
|
| 124 |
+
)
|
| 125 |
+
with c2:
|
| 126 |
+
if st.button("Open", type="primary", key=f"home_go_{i}", disabled=not page_exists):
|
| 127 |
+
st.switch_page(page_path)
|
| 128 |
|
| 129 |
st.divider()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
st.markdown(
|
| 131 |
+
"""
|
| 132 |
+
<section class="pp-lab-card">
|
| 133 |
+
<div class="pp-lab-head">
|
| 134 |
+
<span class="pp-lab-kicker">Research Partner</span>
|
| 135 |
+
<h3 class="pp-lab-title">Developed by MONSTER Lab</h3>
|
| 136 |
+
<p class="pp-lab-subtitle">
|
| 137 |
+
Molecular/Nano-Scale Transport & Energy Research Laboratory | College of Engineering, University of Notre Dame
|
| 138 |
+
</p>
|
| 139 |
+
</div>
|
| 140 |
+
<p class="pp-lab-copy">
|
| 141 |
+
The MONSTER Lab studies the
|
| 142 |
+
physics of energy and mass transport across molecular and nano-scales using theory, simulation,
|
| 143 |
+
data-driven methods, and experiments. The team translates these insights into materials and
|
| 144 |
+
systems for thermal management, energy efficiency, water desalination, high-sensitivity biosensing,
|
| 145 |
+
and additive manufacturing.
|
| 146 |
+
</p>
|
| 147 |
+
<a class="pp-lab-link" href="https://monsterlab.nd.edu/" target="_blank" rel="noopener noreferrer">
|
| 148 |
+
Visit MONSTER Lab Website
|
| 149 |
+
</a>
|
| 150 |
+
</section>
|
| 151 |
+
""",
|
| 152 |
+
unsafe_allow_html=True,
|
| 153 |
)
|
|
|
README.md
CHANGED
|
@@ -1,8 +1,139 @@
|
|
| 1 |
---
|
| 2 |
-
title: Polymer
|
| 3 |
sdk: streamlit
|
| 4 |
python_version: "3.10"
|
| 5 |
app_file: Home.py
|
| 6 |
---
|
| 7 |
|
| 8 |
-
Polymer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Polymer Discovery Platform
|
| 3 |
sdk: streamlit
|
| 4 |
python_version: "3.10"
|
| 5 |
app_file: Home.py
|
| 6 |
---
|
| 7 |
|
| 8 |
+
# Polymer Discovery Platform
|
| 9 |
+
|
| 10 |
+
An integrated Streamlit platform for polymer screening and candidate discovery. The application combines property lookup, machine-learning prediction, molecular visualization, multi-objective discovery, AI-assisted query translation, novel polymer SMILES generation, and export to an automated molecular dynamics workflow.
|
| 11 |
+
|
| 12 |
+
## What The Platform Does
|
| 13 |
+
|
| 14 |
+
The website is organized into seven modules:
|
| 15 |
+
|
| 16 |
+
- `Property Probe`: query a single polymer by SMILES or name and retrieve available database values with prediction fallback.
|
| 17 |
+
- `Batch Prediction`: run multi-property prediction for pasted, uploaded, or built-in polymer sets.
|
| 18 |
+
- `Molecular View`: render 2D and 3D molecular structures and export structure assets.
|
| 19 |
+
- `Discovery (Manual)`: perform explicit constraint-based and multi-objective polymer screening.
|
| 20 |
+
- `Discovery (AI)`: translate natural-language design requests into structured discovery settings with bring-your-own-key LLM support.
|
| 21 |
+
- `Novel SMILES Generation`: sample new polymer candidates with the pretrained RNN and filter against local datasets.
|
| 22 |
+
- `Feedback`: submit issue reports and feature requests through a webhook-backed form.
|
| 23 |
+
|
| 24 |
+
## Core Capabilities
|
| 25 |
+
|
| 26 |
+
- Multi-source property lookup from `EXP`, `MD`, `DFT`, `GC`, and `POLYINFO`
|
| 27 |
+
- Property prediction across 28 polymer properties
|
| 28 |
+
- Large-scale screening over real and virtual candidate libraries
|
| 29 |
+
- Exact Pareto ranking with trust and diversity-aware selection
|
| 30 |
+
- AI-assisted prompt-to-spec generation for discovery workflows
|
| 31 |
+
- Novelty-filtered polymer SMILES generation
|
| 32 |
+
- ADEPT handoff for downstream molecular dynamics workflow packaging
|
| 33 |
+
|
| 34 |
+
## Repository Layout
|
| 35 |
+
|
| 36 |
+
```text
|
| 37 |
+
.
|
| 38 |
+
βββ Home.py # Main Streamlit homepage
|
| 39 |
+
βββ app.py # Compatibility entrypoint
|
| 40 |
+
βββ pages/ # User-facing application modules
|
| 41 |
+
βββ src/ # Prediction, discovery, lookup, and UI logic
|
| 42 |
+
βββ literature/ # Literature-mining pipeline components
|
| 43 |
+
βββ scripts/ # Utility and workflow scripts
|
| 44 |
+
βββ data/ # Lookup tables, discovery datasets, ADEPT files
|
| 45 |
+
βββ models/ # Trained prediction and generation assets
|
| 46 |
+
βββ RNN/ # Generator training/inference code
|
| 47 |
+
βββ icons/ # Application icons and branding assets
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
## Data And Model Assets
|
| 51 |
+
|
| 52 |
+
This repository expects pretrained models and local data tables to be present. The application uses:
|
| 53 |
+
|
| 54 |
+
- source datasets such as `EXP.csv`, `MD.csv`, `DFT.csv`, `GC.csv`, `POLYINFO.csv`, and `PI1M.csv`
|
| 55 |
+
- derived property tables such as `POLYINFO_PROPERTY.parquet` and `PI1M_PROPERTY.parquet`
|
| 56 |
+
- trained checkpoint files under `models/`
|
| 57 |
+
- pretrained RNN assets under `RNN/pretrained_model/` and `models/rnn/pretrained_model/`
|
| 58 |
+
|
| 59 |
+
If you clone only the code without the large assets, several app modules will not run correctly.
|
| 60 |
+
|
| 61 |
+
## Local Development
|
| 62 |
+
|
| 63 |
+
Use Python `3.10`.
|
| 64 |
+
|
| 65 |
+
```bash
|
| 66 |
+
python3 -m venv .venv
|
| 67 |
+
source .venv/bin/activate
|
| 68 |
+
pip install -r requirements.txt
|
| 69 |
+
streamlit run Home.py
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
+
Open `http://localhost:8501`.
|
| 73 |
+
|
| 74 |
+
## Optional Literature Pipeline Dependencies
|
| 75 |
+
|
| 76 |
+
The literature workflow is separated from the main app dependencies.
|
| 77 |
+
|
| 78 |
+
```bash
|
| 79 |
+
pip install -r requirements-literature.txt
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
This is only required if you plan to use or extend the literature-mining workflow.
|
| 83 |
+
|
| 84 |
+
## Environment Configuration
|
| 85 |
+
|
| 86 |
+
Create a local `.env` file if needed. The template is provided in `.env.example`.
|
| 87 |
+
|
| 88 |
+
Key variables used by the platform include:
|
| 89 |
+
|
| 90 |
+
### LLM / Discovery AI
|
| 91 |
+
|
| 92 |
+
- `CRC_OPENWEBUI_API_KEY`
|
| 93 |
+
- `OPENWEBUI_API_KEY`
|
| 94 |
+
- `OPENAI_API_KEY`
|
| 95 |
+
- `CRC_OPENWEBUI_BASE_URL`
|
| 96 |
+
- `OPENWEBUI_BASE_URL`
|
| 97 |
+
- `CRC_OPENWEBUI_MODEL`
|
| 98 |
+
- `OPENWEBUI_MODEL`
|
| 99 |
+
- `OPENAI_MODEL`
|
| 100 |
+
|
| 101 |
+
The Discovery AI page also supports direct bring-your-own-key usage against supported providers from the UI.
|
| 102 |
+
|
| 103 |
+
### Literature Pipeline
|
| 104 |
+
|
| 105 |
+
- `PUBMED_EMAIL`
|
| 106 |
+
- `PUBMED_API_KEY`
|
| 107 |
+
- `SEMANTIC_SCHOLAR_API_KEY`
|
| 108 |
+
- `PAGEINDEX_API_KEY`
|
| 109 |
+
- `LITERATURE_MODEL_OPTIONS`
|
| 110 |
+
|
| 111 |
+
### Feedback / Analytics
|
| 112 |
+
|
| 113 |
+
- `FEEDBACK_WEBHOOK_URL`
|
| 114 |
+
- `FEEDBACK_WEBHOOK_TOKEN`
|
| 115 |
+
- `APP_DEPLOYMENT_SOURCE`
|
| 116 |
+
|
| 117 |
+
## Running With Docker
|
| 118 |
+
|
| 119 |
+
```bash
|
| 120 |
+
docker build -t polymer-discovery .
|
| 121 |
+
docker run --rm -p 8501:8501 polymer-discovery
|
| 122 |
+
```
|
| 123 |
+
|
| 124 |
+
The container launches:
|
| 125 |
+
|
| 126 |
+
```bash
|
| 127 |
+
streamlit run Home.py --server.port=8501 --server.address=0.0.0.0 --server.headless=true
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
## Notes For Deployment
|
| 131 |
+
|
| 132 |
+
- The app is designed as a Streamlit website.
|
| 133 |
+
- Heavy modules depend on local datasets and pretrained checkpoints being available at the expected paths.
|
| 134 |
+
- The AI-assisted discovery page requires a valid API key when using in-app LLM generation.
|
| 135 |
+
- The feedback page requires a configured webhook to receive submissions.
|
| 136 |
+
|
| 137 |
+
## Citation And Use
|
| 138 |
+
|
| 139 |
+
If you use this platform in research or build on top of it, cite the associated paper once published. Until then, reference the repository and the MONSTER Lab platform description.
|
app.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Compatibility entrypoint.
|
| 2 |
+
|
| 3 |
+
Keeps legacy `streamlit run app.py` working by delegating to the actual
|
| 4 |
+
homepage implementation in `Home.py`.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from Home import * # noqa: F401,F403
|