Lukas Korganas
Fix Gradio SDK version pin
8f10d91
|
Raw
History Blame Contribute Delete
1.4 kB

A newer version of the Gradio SDK is available: 6.26.0

Upgrade
metadata
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

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

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"
))