Spaces:
Sleeping
Sleeping
ADjayantan commited on
Commit ·
7764288
1
Parent(s): d686612
Upgrade Gradio SDK to 4.44.0 and resolve spaces runtime error
Browse files- README.md +3 -20
- app_gradio.py +9 -3
- requirements.txt +1 -1
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 🧬
|
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
app_file: app_gradio.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
|
@@ -14,10 +14,10 @@ license: mit
|
|
| 14 |
### Tissue-Conditioned Zero-Shot Side Effect Disaggregation Platform
|
| 15 |
|
| 16 |
[](https://github.com/ADjayantan/EpiADR-Net/actions)
|
| 17 |
-
[](https://huggingface.co/spaces)
|
| 18 |
[](https://www.python.org/)
|
| 19 |
[](https://fastapi.tiangolo.com/)
|
| 20 |
-
[](https://opensource.org/licenses/MIT)
|
| 22 |
|
| 23 |
**EpiADR-Net** is an end-to-end, publication-grade research platform and enterprise microservice stack engineered for **Tissue-Conditioned Zero-Shot Side Effect Disaggregation**. It predicts organ-specific Adverse Drug Reactions (ADRs) by conditioning molecular Graph Neural Network representations on human organ transcriptomic profiles.
|
|
@@ -70,20 +70,3 @@ Swagger UI available at: [http://localhost:8000/docs](http://localhost:8000/docs
|
|
| 70 |
```bash
|
| 71 |
streamlit run app.py
|
| 72 |
```
|
| 73 |
-
|
| 74 |
-
---
|
| 75 |
-
|
| 76 |
-
## 🔗 Hugging Face Space & GitHub Sync
|
| 77 |
-
|
| 78 |
-
To automatically sync your GitHub repository with Hugging Face Spaces (`https://huggingface.co/new-space?sdk=gradio`):
|
| 79 |
-
|
| 80 |
-
1. **Create a Hugging Face Space**:
|
| 81 |
-
- Go to [huggingface.co/new-space](https://huggingface.co/new-space?sdk=gradio)
|
| 82 |
-
- Set Space Name: `EpiADR-Net`
|
| 83 |
-
- Select SDK: `Gradio`
|
| 84 |
-
- License: `MIT`
|
| 85 |
-
2. **Add Hugging Face Secret to GitHub**:
|
| 86 |
-
- Get your Hugging Face Access Token from [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) (Write permission).
|
| 87 |
-
- In GitHub repository settings -> Secrets and variables -> Actions -> Create repository secret named `HF_TOKEN`.
|
| 88 |
-
3. **Automated Deployment**:
|
| 89 |
-
- Every `git push` to `main` branch will automatically sync to Hugging Face via `.github/workflows/huggingface_sync.yml`!
|
|
|
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 4.44.0
|
| 8 |
app_file: app_gradio.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
|
|
|
| 14 |
### Tissue-Conditioned Zero-Shot Side Effect Disaggregation Platform
|
| 15 |
|
| 16 |
[](https://github.com/ADjayantan/EpiADR-Net/actions)
|
| 17 |
+
[](https://huggingface.co/spaces/jayantan/EpiADR-Net)
|
| 18 |
[](https://www.python.org/)
|
| 19 |
[](https://fastapi.tiangolo.com/)
|
| 20 |
+
[](https://gradio.app/)
|
| 21 |
[](https://opensource.org/licenses/MIT)
|
| 22 |
|
| 23 |
**EpiADR-Net** is an end-to-end, publication-grade research platform and enterprise microservice stack engineered for **Tissue-Conditioned Zero-Shot Side Effect Disaggregation**. It predicts organ-specific Adverse Drug Reactions (ADRs) by conditioning molecular Graph Neural Network representations on human organ transcriptomic profiles.
|
|
|
|
| 70 |
```bash
|
| 71 |
streamlit run app.py
|
| 72 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app_gradio.py
CHANGED
|
@@ -9,6 +9,12 @@ from utils import smiles_to_graph, highlight_toxic_subgraph
|
|
| 9 |
from data_loader import GTEX_TISSUE_PROFILES, MEDDRA_ADR_CLASSES, ORGAN_NAMES, BENCHMARK_DRUGS
|
| 10 |
from model import EpiADRNet
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
# Load model instance
|
| 13 |
MODEL = EpiADRNet(in_features=5, hidden_dim=128, num_classes=10, dropout=0.2)
|
| 14 |
try:
|
|
@@ -18,12 +24,12 @@ except Exception:
|
|
| 18 |
MODEL.eval()
|
| 19 |
|
| 20 |
|
| 21 |
-
def predict_single_organ(smiles: str, organ: str, mc_passes: int) -> Tuple[pd.DataFrame, str,
|
| 22 |
"""
|
| 23 |
Predicts organ-conditioned ADR probabilities, epistemic uncertainty, and XAI toxic hotspots.
|
| 24 |
"""
|
| 25 |
if not smiles or organ not in GTEX_TISSUE_PROFILES:
|
| 26 |
-
return pd.DataFrame(), "Invalid SMILES or Organ",
|
| 27 |
|
| 28 |
node_feats, edge_index, atom_symbols = smiles_to_graph(smiles)
|
| 29 |
batch = torch.zeros(node_feats.size(0), dtype=torch.long)
|
|
@@ -180,4 +186,4 @@ with gr.Blocks(title="EpiADR-Net — Hugging Face Space", theme=gr.themes.Soft()
|
|
| 180 |
)
|
| 181 |
|
| 182 |
if __name__ == "__main__":
|
| 183 |
-
demo.launch()
|
|
|
|
| 9 |
from data_loader import GTEX_TISSUE_PROFILES, MEDDRA_ADR_CLASSES, ORGAN_NAMES, BENCHMARK_DRUGS
|
| 10 |
from model import EpiADRNet
|
| 11 |
|
| 12 |
+
# Optional spaces import for HF Zero-GPU runtime compatibility
|
| 13 |
+
try:
|
| 14 |
+
import spaces
|
| 15 |
+
except ImportError:
|
| 16 |
+
spaces = None
|
| 17 |
+
|
| 18 |
# Load model instance
|
| 19 |
MODEL = EpiADRNet(in_features=5, hidden_dim=128, num_classes=10, dropout=0.2)
|
| 20 |
try:
|
|
|
|
| 24 |
MODEL.eval()
|
| 25 |
|
| 26 |
|
| 27 |
+
def predict_single_organ(smiles: str, organ: str, mc_passes: int) -> Tuple[pd.DataFrame, str, Any]:
|
| 28 |
"""
|
| 29 |
Predicts organ-conditioned ADR probabilities, epistemic uncertainty, and XAI toxic hotspots.
|
| 30 |
"""
|
| 31 |
if not smiles or organ not in GTEX_TISSUE_PROFILES:
|
| 32 |
+
return pd.DataFrame(), "Invalid SMILES or Organ", None
|
| 33 |
|
| 34 |
node_feats, edge_index, atom_symbols = smiles_to_graph(smiles)
|
| 35 |
batch = torch.zeros(node_feats.size(0), dtype=torch.long)
|
|
|
|
| 186 |
)
|
| 187 |
|
| 188 |
if __name__ == "__main__":
|
| 189 |
+
demo.queue().launch()
|
requirements.txt
CHANGED
|
@@ -5,7 +5,7 @@ scikit-learn>=1.0.0
|
|
| 5 |
fastapi>=0.95.0
|
| 6 |
uvicorn>=0.20.0
|
| 7 |
streamlit>=1.20.0
|
| 8 |
-
gradio>=
|
| 9 |
matplotlib>=3.5.0
|
| 10 |
plotly>=5.10.0
|
| 11 |
pytest>=7.0.0
|
|
|
|
| 5 |
fastapi>=0.95.0
|
| 6 |
uvicorn>=0.20.0
|
| 7 |
streamlit>=1.20.0
|
| 8 |
+
gradio>=4.44.0
|
| 9 |
matplotlib>=3.5.0
|
| 10 |
plotly>=5.10.0
|
| 11 |
pytest>=7.0.0
|