File size: 1,399 Bytes
01c9799 64c6b78 01c9799 8f10d91 01c9799 64c6b78 01c9799 64c6b78 8f10d91 64c6b78 8f10d91 64c6b78 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | ---
title: Dynamic Transformers Pipeline API
emoji: ๐
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: "6.22.0"
app_file: app.py
pinned: false
license: apache-2.0
---
# Dynamic Transformers Pipeline API
Pass any `transformers.pipeline()` config as JSON, run inference on ZeroGPU RTX Pro 6000 Blackwell.
## API Usage
```python
from gradio_client import Client
client = Client("DoctorSlimm/dynamic-transformers-api")
result = client.predict(
pipeline_config={"task": "text-generation", "model": "HuggingFaceTB/SmolLM2-135M-Instruct"},
inputs="Hello world",
inference_kwargs={"max_new_tokens": 50},
api_name="/inference"
)
```
---
## 3. Hit deploy
Upload โ Space builds (~30-60s) โ done.
---
## 4. Test it
```python
from gradio_client import Client
client = Client("DoctorSlimm/dynamic-transformers-api")
# Text generation
print(client.predict(
pipeline_config={"task": "text-generation", "model": "HuggingFaceTB/SmolLM2-135M-Instruct"},
inputs="The future of AI is",
inference_kwargs={"max_new_tokens": 50},
api_name="/inference"
))
# NER (swap pipeline on the fly, same Space)
print(client.predict(
pipeline_config={"task": "ner", "model": "Jean-Baptiste/camembert-ner", "aggregation_strategy": "simple"},
inputs="Apple is looking at buying U.K. startup for $1 billion",
inference_kwargs={},
api_name="/inference"
))
```
|