rdkit_api / README.md
Nanny7's picture
Update README with new reaction visualizer endpoint
42f5484
---
title: RDKit API
emoji: 🔬
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: "4.44.1"
app_file: app.py
pinned: false
---
# RDKit API
This is a Hugging Face Space providing API access to various RDKit cheminformatics functions.
## Endpoints
- `POST /api/name_to_smiles` : Convert chemical name to SMILES
- `POST /api/name_to_3d_molecule` : Generate 3D molecule visualization
- `POST /api/smiles_to_mol` : Convert SMILES to canonical SMILES
- `POST /api/molecular_weight` : Calculate molecular weight
- `POST /api/logp` : Calculate logP (partition coefficient)
- `POST /api/tpsa` : Calculate TPSA (topological polar surface area)
- `POST /api/chemiscope_explorer` : Build a Chemiscope dataset + visualization from a batch of SMILES
- `POST /api/reaction_visualizer` : Generate SVG visualization of chemical reactions from reaction SMILES
- `POST /api/mol_image` : Generate 2D molecule image (returns PIL Image)
## Usage
To deploy on Hugging Face Spaces, upload this repository.
For local testing, run:
```bash
pip install -r requirements.txt
python app.py
```
The API endpoints can be accessed programmatically using the Gradio client or HTTP requests.
## Chemiscope-powered exploration
The new **Chemiscope Explorer** tab leverages the official [`chemiscope` Python package](https://chemiscope.org/docs/python/index.html) plus the standalone Chemiscope web viewer to create rich, shareable datasets directly inside the Space:
1. Paste up to 12 SMILES (one per line or comma-separated). RDKit generates 3D ETKDG conformers, computes descriptors (MolWt, logP, TPSA, H-bond counts, rotatable bonds) and per-atom Gasteiger charges.
2. The resulting ASE frames and descriptors are converted into the Chemiscope JSON schema and embedded with the [`chemiscope_standalone.html`](https://chemiscope.org/docs/index.html) viewer so you can explore structures + map plots without leaving the Space.
3. Download the `.json.gz` artifact and reload it later on [chemiscope.org](https://chemiscope.org/) via the *Load/Save* menu or by hosting it and passing `?load=<url>` to share interactive analyses with collaborators.
This flow keeps the Hugging Face interface lightweight while exposing the full Chemiscope feature set for interactive dataset mining.