Transformers documentation

머신러닝 앱

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

머신러닝 앱

Gradio는 머신러닝 앱을 빠르게 구축하고 공유할 수 있는 간편한 라이브러리로, Pipeline과 통합되어 추론을 위한 간단한 인터페이스를 신속하게 생성할 수 있습니다.

시작하기 전에 Gradio가 설치되어 있는지 확인하세요.

!pip install gradio

작업에 맞는 pipeline을 생성한 후, Gradio의 Interface.from_pipeline 함수에 전달하여 인터페이스를 생성합니다. Gradio는 Pipeline에 대해 적절한 입력 및 출력 구성 요소를 자동으로 결정합니다.

launch를 추가하여 웹 서버를 생성하고 앱을 시작합니다.

from transformers import pipeline
import gradio as gr

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

웹 앱은 기본적으로 로컬 서버에서 실행됩니다. 다른 사용자와 앱을 공유하려면 launch에서 share=True를 설정하여 임시 공개 링크를 생성하세요. 보다 영구적인 솔루션을 원하시면 Hugging Face Spaces에 앱을 호스팅하세요.

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

Space는 위의 코드로 생성되어 Spaces에 호스팅됩니다.

Update on GitHub