Files
wehub-resource-sync e06fe8e8c6
Secret Leaks / trufflehog (push) Failing after 1s
Build documentation / build (push) Failing after 1s
Build documentation / build_other_lang (push) Failing after 0s
CodeQL Security Analysis / CodeQL Analysis (push) Failing after 0s
PR CI / pr-ci (push) Failing after 1s
Slow tests on important models (on Push - A10) / Get all modified files (push) Failing after 1s
Slow tests on important models (on Push - A10) / Model CI (push) Has been skipped
Self-hosted runner (benchmark) / Benchmark (aws-g5-4xlarge-cache) (push) Has been cancelled
New model PR merged notification / Notify new model (push) Has been cancelled
Update Transformers metadata / build_and_package (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:57:37 +08:00

2.2 KiB

Machine learning apps

Gradio, a fast and easy library for building and sharing machine learning apps, is integrated with [Pipeline] to quickly create a simple interface for inference.

Before you begin, make sure Gradio is installed.

!pip install gradio

Create a pipeline for your task, and then pass it to Gradio's Interface.from_pipeline function to create the interface. Gradio automatically determines the appropriate input and output components for a [Pipeline].

Add launch to create a web server and start up the app.

from transformers import pipeline
import gradio as gr

pipeline = pipeline("image-classification", model="google/vit-base-patch16-224")
gr.Interface.from_pipeline(pipeline).launch()

The web app runs on a local server by default. To share the app with other users, set share=True in launch to generate a temporary public link. For a more permanent solution, host the app on Hugging Face Spaces.

gr.Interface.from_pipeline(pipeline).launch(share=True)

The Space below is created with the code above and hosted on Spaces.