Spaces:
Sleeping
Sleeping
devjas1 commited on
Commit Β·
c446b65
1
Parent(s): bd46e31
(DOCS): finalize research-grade README with agnostic OCI instructions and scientific baseline
Browse files
README.md
CHANGED
|
@@ -1,180 +1,119 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
emoji: π¬
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: green
|
| 6 |
sdk: docker
|
| 7 |
app_port: 7860
|
| 8 |
pinned: false
|
| 9 |
-
license:
|
| 10 |
---
|
| 11 |
|
| 12 |
-
# PolymerOS:
|
| 13 |
|
| 14 |

|
| 15 |

|
| 16 |
-

|
| 19 |
|
|
|
|
|
|
|
| 20 |
---
|
| 21 |
|
| 22 |
## Overview
|
| 23 |
|
| 24 |
-
**PolymerOS** is
|
| 25 |
-
It enables scientists, engineers, and researchers to upload spectroscopic data and receive predictions on whether materials are **stable (unweathered)** or **weathered (degraded)**.
|
| 26 |
|
| 27 |
-
|
| 28 |
|
| 29 |
---
|
| 30 |
|
| 31 |
-
##
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
- **
|
| 36 |
-
- **
|
| 37 |
-
- **
|
| 38 |
-
- **Provenance Tracking**: QC checks + preprocessing metadata
|
| 39 |
-
- **Performance Dashboard**
|
| 40 |
-
- **RESTful API** for programmatic access
|
| 41 |
-
- **Modern UI**: React + TypeScript, charting with Recharts
|
| 42 |
|
| 43 |
-
|
|
|
|
| 44 |
|
| 45 |
-
|
| 46 |
|
| 47 |
-
|
| 48 |
|
| 49 |
```text
|
| 50 |
-
|
| 51 |
βββ backend/
|
| 52 |
-
β βββ main.py #
|
| 53 |
-
β βββ
|
| 54 |
-
β
|
| 55 |
-
β βββ utils/
|
| 56 |
-
β
|
| 57 |
-
β
|
| 58 |
-
β
|
| 59 |
βββ frontend/
|
| 60 |
-
β βββ src/
|
| 61 |
-
β β
|
| 62 |
-
β
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
βββ models/weights/ # Directory for trained model weights (.pth)
|
| 67 |
-
βββ Dockerfile # Multi-stage build for backend+frontend
|
| 68 |
-
βββ main.py # Root entrypoint: serves frontend + backend
|
| 69 |
-
```
|
| 70 |
-
|
| 71 |
-
---
|
| 72 |
-
|
| 73 |
-
## Data Flow
|
| 74 |
-
|
| 75 |
-
Example: Standard Spectrum Analysis
|
| 76 |
-
|
| 77 |
-
```mermaid
|
| 78 |
-
sequenceDiagram
|
| 79 |
-
participant User
|
| 80 |
-
participant UI as React UI
|
| 81 |
-
participant API as FastAPI Backend
|
| 82 |
-
participant ML as ML Service
|
| 83 |
-
User->>UI: Upload spectrum file
|
| 84 |
-
UI->>API: POST /api/v1/upload
|
| 85 |
-
API->>ML: Parse + preprocess spectrum
|
| 86 |
-
ML->>ML: Run model inference
|
| 87 |
-
ML-->>API: PredictionResult (class + confidence + provenance)
|
| 88 |
-
API-->>UI: JSON response
|
| 89 |
-
UI-->>User: Display prediction & visualization
|
| 90 |
```
|
| 91 |
|
| 92 |
---
|
| 93 |
|
| 94 |
-
##
|
| 95 |
-
|
| 96 |
-
### Prerequisites
|
| 97 |
-
|
| 98 |
-
- Python 3.10+
|
| 99 |
-
- Node.js 16+
|
| 100 |
-
- npm
|
| 101 |
-
- Git
|
| 102 |
-
|
| 103 |
-
### Setup
|
| 104 |
-
|
| 105 |
-
```bash
|
| 106 |
-
# Clone repo
|
| 107 |
-
git clone https://github.com/devjas1/polymeros.git
|
| 108 |
-
cd polymeros
|
| 109 |
-
|
| 110 |
-
# Backend setup
|
| 111 |
-
pip install -r backend/requirements.txt
|
| 112 |
-
|
| 113 |
-
# Frontend setup
|
| 114 |
-
cd frontend
|
| 115 |
-
npm install
|
| 116 |
-
cd ..
|
| 117 |
-
```
|
| 118 |
|
| 119 |
-
###
|
|
|
|
|
|
|
| 120 |
|
|
|
|
| 121 |
```bash
|
| 122 |
-
#
|
| 123 |
-
|
|
|
|
| 124 |
|
| 125 |
-
#
|
| 126 |
-
|
| 127 |
-
|
| 128 |
```
|
| 129 |
|
| 130 |
-
###
|
|
|
|
| 131 |
|
| 132 |
```bash
|
| 133 |
-
|
| 134 |
-
|
| 135 |
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
---
|
| 139 |
-
|
| 140 |
-
## Tests
|
| 141 |
-
|
| 142 |
-
```bash
|
| 143 |
-
# From repo root
|
| 144 |
-
export PYTHONPATH=$PWD
|
| 145 |
-
pytest backend/tests
|
| 146 |
```
|
|
|
|
| 147 |
|
| 148 |
---
|
| 149 |
|
| 150 |
-
##
|
| 151 |
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
```bash
|
| 155 |
-
docker build -t polymeros .
|
| 156 |
-
docker run -p 8000:8000 polymeros
|
| 157 |
-
```
|
| 158 |
-
|
| 159 |
-
### Hugging Face Spaces
|
| 160 |
-
|
| 161 |
-
PolymerOS is optimized for deployment on Hugging Face Spaces with unified API + UI on a single port.
|
| 162 |
|
| 163 |
---
|
| 164 |
|
| 165 |
## Contributors
|
| 166 |
|
| 167 |
-
- **Dhoopshikha Lakshmi Devi Basgeet**
|
| 168 |
-
- **Jaser Hasan** β Developer
|
| 169 |
- **Konpal Raheja**
|
| 170 |
- **Divita Mathur**
|
| 171 |
-
- **Dr. Sanmukh Kuppannagari** β
|
| 172 |
-
- **Dr. Metin
|
| 173 |
|
| 174 |
---
|
| 175 |
|
| 176 |
## License
|
| 177 |
|
| 178 |
-
Apache 2.0
|
| 179 |
-
|
| 180 |
-
---
|
|
|
|
| 1 |
---
|
| 2 |
+
title: "PolymerOS: Predictive Framework for Polymer Aging"
|
| 3 |
emoji: π¬
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: green
|
| 6 |
sdk: docker
|
| 7 |
app_port: 7860
|
| 8 |
pinned: false
|
| 9 |
+
license: apache-2.0
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# PolymerOS: A Computational Framework for Degradation-Aware Plastic Classification
|
| 13 |
|
| 14 |

|
| 15 |

|
| 16 |
+

|
| 17 |
+

|
| 18 |

|
| 19 |
|
| 20 |
+
[**Live Interactive Dashboard**](https://huggingface.co/spaces/dev-jas/polymer-aging-with-ml) | [**Official Repository**](https://github.com/KLab-AI3/ml-polymer-recycling)
|
| 21 |
+
|
| 22 |
---
|
| 23 |
|
| 24 |
## Overview
|
| 25 |
|
| 26 |
+
**PolymerOS** is the official computational framework for the predictive aging of plastics as described in the manuscript *"Predictive Framework to Indicate the Age of Plastics for Proper Recycling."*
|
|
|
|
| 27 |
|
| 28 |
+
Conventional mechanical recycling often overlooks the degradation history of materials, leading to inconsistent product quality. This framework utilizes **deep learning applied to Raman and FTIR spectroscopy** to identify early-stage chemical and physical aging signatures. It provides a standardized, secure, and reproducible environment for the scientific classification of aged versus unaged polymers.
|
| 29 |
|
| 30 |
---
|
| 31 |
|
| 32 |
+
## Core Research Artifacts
|
| 33 |
|
| 34 |
+
### 1. Model Zoo
|
| 35 |
+
Verified architectures and weights for the following models are provided:
|
| 36 |
+
- **Figure2CNN**: High-performance binary classifier (Aged vs. Unaged) optimized for spectral data.
|
| 37 |
+
- **ResNet1D**: Benchmarked 1D-convolutional architecture for spectral feature extraction.
|
| 38 |
+
- **Preprocessing Pipeline**: A standardized 4-step sequence including asymmetric least-squares baseline correction, SavitzkyβGolay smoothing, min-max normalization, and resampling to 4000 spectral points.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
+
### 2. Standalone Scientific Appliance
|
| 41 |
+
To facilitate reproducibility and practical use by researchers, the entire pipelineβincluding the interactive dashboard, inference engine, and preprocessing logicβis delivered as a **portable OCI container**.
|
| 42 |
|
| 43 |
+
---
|
| 44 |
|
| 45 |
+
## Technical Architecture
|
| 46 |
|
| 47 |
```text
|
| 48 |
+
ml-polymer-recycling/
|
| 49 |
βββ backend/
|
| 50 |
+
β βββ main.py # API entrypoint and static asset server
|
| 51 |
+
β βββ models/
|
| 52 |
+
β β βββ weights/ # Model binaries (.pth managed via Git LFS)
|
| 53 |
+
β βββ utils/
|
| 54 |
+
β β βββ model_manager.py # Hardened PyTorch 2.6 safe-loading logic
|
| 55 |
+
β β βββ preprocessing.py # Standardized 4-step spectral preprocessing
|
| 56 |
+
β βββ service.py # Core inference orchestration
|
| 57 |
βββ frontend/
|
| 58 |
+
β βββ src/ # React/TypeScript source code
|
| 59 |
+
β β βββ apiClient.ts # Location-agnostic API Client
|
| 60 |
+
β βββ dist/ # Compiled production assets
|
| 61 |
+
βββ Dockerfile # Multi-stage hardened OCI build configuration
|
| 62 |
+
βββ requirements.txt # Python environment specifications
|
| 63 |
+
βββ .gitattributes # Git LFS tracking for model weights
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
```
|
| 65 |
|
| 66 |
---
|
| 67 |
|
| 68 |
+
## Reproducibility & Local Operation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
+
### 1. Prerequisites
|
| 71 |
+
- **Git LFS** (Required to download model weight binaries).
|
| 72 |
+
- **Docker** or **Podman**.
|
| 73 |
|
| 74 |
+
### 2. Setup
|
| 75 |
```bash
|
| 76 |
+
# Clone the official repository
|
| 77 |
+
git clone https://github.com/KLab-AI3/ml-polymer-recycling.git
|
| 78 |
+
cd ml-polymer-recycling
|
| 79 |
|
| 80 |
+
# Initialize LFS and pull model weights
|
| 81 |
+
git lfs install
|
| 82 |
+
git lfs pull
|
| 83 |
```
|
| 84 |
|
| 85 |
+
### 3. Running the Dashboard
|
| 86 |
+
To ensure bit-perfect scientific parity with the benchmarks reported in the manuscript, we recommend running the framework as a standalone appliance. The container is internally hardened to run in a restricted, read-only state.
|
| 87 |
|
| 88 |
```bash
|
| 89 |
+
# Build the appliance
|
| 90 |
+
docker build -t polymer-os .
|
| 91 |
|
| 92 |
+
# Launch the dashboard
|
| 93 |
+
docker run -p 7860:7860 polymer-os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
```
|
| 95 |
+
The interactive interface will be available at: **http://localhost:7860**
|
| 96 |
|
| 97 |
---
|
| 98 |
|
| 99 |
+
## Security & Agnosticism
|
| 100 |
|
| 101 |
+
- **PyTorch 2.6 Enforcement**: Models are loaded using the hardened `weights_only=True` standard to ensure safe execution in public environments.
|
| 102 |
+
- **Environment Aware**: The "Agnostic" API client automatically detects host and port settings, ensuring seamless transitions between local workstations and cloud providers like Hugging Face Spaces.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
---
|
| 105 |
|
| 106 |
## Contributors
|
| 107 |
|
| 108 |
+
- **Dhoopshikha Lakshmi Devi Basgeet** β Lead Author
|
| 109 |
+
- **Jaser Hasan** β Lead Developer / Technical Audit
|
| 110 |
- **Konpal Raheja**
|
| 111 |
- **Divita Mathur**
|
| 112 |
+
- **Dr. Sanmukh Kuppannagari** β Corresponding Author
|
| 113 |
+
- **Dr. Metin Karayilan** β Corresponding Author
|
| 114 |
|
| 115 |
---
|
| 116 |
|
| 117 |
## License
|
| 118 |
|
| 119 |
+
Licensed under the Apache License, Version 2.0 (the "License"); see [LICENSE](LICENSE) for details.
|
|
|
|
|
|