README: hosted API section
Browse files
README.md
CHANGED
|
@@ -32,6 +32,42 @@ fast = CapacitancePredictor(load_model("fast")).predict("chip.gds") # Fast
|
|
| 32 |
res.names, res.matrix_fF, res.to_sim_results()
|
| 33 |
```
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
## Tiers
|
| 36 |
|
| 37 |
This repository holds all three tiers in `accurate/`, `balanced/` and `fast/`. SQuADDS loads Accurate and Fast, and the [Space](https://huggingface.co/spaces/shanto268/PlanarCapacitanceModel) serves all three.
|
|
|
|
| 32 |
res.names, res.matrix_fF, res.to_sim_results()
|
| 33 |
```
|
| 34 |
|
| 35 |
+
## Hosted API
|
| 36 |
+
|
| 37 |
+
The [SQuADDS ML inference API](https://huggingface.co/spaces/SQuADDS/squadds-ml-inference-api) serves these models over HTTP as `planar_capacitance_flagship` (Accurate) and `planar_capacitance_fast`. They go live there when the paper is published. Until then, run them locally with SQuADDS as above.
|
| 38 |
+
|
| 39 |
+
- `GET /v1/models/planar_capacitance_flagship` describes the model, with its inputs, limits and an example.
|
| 40 |
+
- `GET /v1/models/planar_capacitance_flagship/schema?format=tool` gives a ready tool definition for AI agents.
|
| 41 |
+
- `POST /v1/models/planar_capacitance_flagship/predict` takes the GDS file as the multipart field `file`, or base64 encoded in `inputs.file_base64` of a JSON body. The optional inputs are `ground_layer` and `conductor_layer` (`1/0` and `1/10` by default), `eps_r` and `thickness_um` (11.45 and 350 µm), and `ground_pieces` when ground and conductors share a layer.
|
| 42 |
+
|
| 43 |
+
```bash
|
| 44 |
+
curl -X POST https://squadds-squadds-ml-inference-api.hf.space/v1/models/planar_capacitance_flagship/predict \
|
| 45 |
+
-F file=@chip.gds -F 'inputs={"ground_layer": "1/0", "conductor_layer": "1/10"}'
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
```python
|
| 49 |
+
from squadds.ml import client
|
| 50 |
+
|
| 51 |
+
r = client.predict("planar_capacitance_flagship", file="chip.gds")
|
| 52 |
+
r["outputs"]["names"], r["outputs"]["matrix_fF"]
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
The response for the interdigital example layout:
|
| 56 |
+
|
| 57 |
+
```json
|
| 58 |
+
{
|
| 59 |
+
"model_id": "planar_capacitance_flagship",
|
| 60 |
+
"outputs": {
|
| 61 |
+
"names": ["G", "C1", "C2"],
|
| 62 |
+
"matrix_fF": [[31.727, -4.264, -5.711], [-4.264, 6.598, -2.285], [-5.711, -2.285, 8.045]],
|
| 63 |
+
"units": "fF",
|
| 64 |
+
"convention": "Maxwell matrix, ground first (row and column 0), nets never merged"
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
The API takes up to 70 conductors plus ground and 20 MB per file. It runs one prediction at a time on two shared vCPUs, so large layouts take minutes. The full list of hosted models is at `GET /v1/models`.
|
| 70 |
+
|
| 71 |
## Tiers
|
| 72 |
|
| 73 |
This repository holds all three tiers in `accurate/`, `balanced/` and `fast/`. SQuADDS loads Accurate and Fast, and the [Space](https://huggingface.co/spaces/shanto268/PlanarCapacitanceModel) serves all three.
|