Pipeline apps and web servers
Wrap a Pipeline in a Gradio demo or a lightweight web server for internal tools and prototypes.
Adapted for this playbook from the 🤗 Transformers documentation by Hugging Face. Official page: https://huggingface.co/docs/transformers/pipeline_gradio. Images © Hugging Face (
documentation-images) unless noted. This is not a substitute for the upstream docs — verify against the current version.Covers Hugging Face pages: pipeline_gradio, pipeline_webserver
Gradio sketch​
import gradio as gr
from transformers import pipeline
pipe = pipeline("sentiment-analysis")
def predict(text):
return pipe(text)[0]
gr.Interface(fn=predict, inputs="text", outputs="json").launch()
Official guide: Machine learning apps.
Web server inference​
Hugging Face documents serving Pipelines behind HTTP for simple deployments — see Web server inference. For multi-user LLM serving, prefer Serving or Inference engines.
Production caution​
- Gradio demos are not a hardened multi-tenant gateway.
- Add auth, rate limits, request size caps and PII controls before exposing client data.
Discussion
Comments​
Share feedback or questions about this page. No account required.
Loading comments…