CoolFace
Apppublic

Bradleyyb37/Quantitative_toxicity_prediction

sourceHugging Facemitupdated 8mo agoView on Hugging Face
1likes
App README

๐Ÿงช ActFound-based Toxicity Predictor

This Space provides EC10 toxicity predictions from SMILES strings using a fine-tuned ActFound meta-learning model.


๐Ÿ”ง How it works

  • โ€”Base model: ActFoundRegressor (meta-learning QSAR)
  • โ€”Input: SMILES โ†’ 2048-d Morgan fingerprint (via RDKit)
  • โ€”Inner loop: Meta-learning adaptation using a fixed support set (EC10_support.json)
  • โ€”Output: Predicted EC10 (e.g., -log10(EC) in BEAS-2b cells)

๐Ÿ“‚ Files

  • โ€”app.py โ€“ Gradio UI (single + batch prediction)
  • โ€”inference.py โ€“ Core inference logic (predict, predict_batch)
  • โ€”requirements.txt โ€“ Dependency versions
  • โ€”EC10_support.json โ€“ Support compounds and EC10 labels
  • โ€”actfound_finetuned_ec10.pt โ€“ Fine-tuned model weights (state_dict)
  • โ€”Actfound_demo/ โ€“ Model definitions (system_actfound.py, etc.)
โš  Note: system_actfound.py must be edited so that all .cuda() calls are replaced with device-agnostic code (e.g., .to(device)).

โœ… Usage (Web UI)

  1. 1.Open the Space.
  2. 2.Single Prediction tab:
  3. 3.Enter a SMILES string.
  4. 4.Click Predict.
  5. 5.The EC10 value will be displayed on the right.
  6. 6.Batch Prediction tab:
  7. 7.Fill or paste a list of SMILES in the table.
  8. 8.Click Predict Batch.
  9. 9.A result table with predicted EC10 values will appear.

๐Ÿ”Œ Programmatic API Example (Python)

If your Space is public (e.g., https://huggingface.co/spaces/yourname/actfound-ec10), you can call the Gradio API endpoint like:

python
import requests

SPACE_URL = "https://yourname-actfound-ec10.hf.space"

payload = {
    "data": ["CC1=CC=CC=C1"]  # single SMILES input for the main function
}

res = requests.post(f"{SPACE_URL}/api/predict", json=payload)
print(res.json())