Huggingface Endpoints
The Hugging Face Hub is a platform with over 120k models, 20k datasets, and 50k demo apps (Spaces), all open source and publicly available, in an online platform where people can easily collaborate and build ML together.
The Hugging Face Hub
also offers various endpoints to build ML applications.
This example showcases how to connect to the different Endpoints types.
In particular, text generation inference is powered by Text Generation Inference: a custom-built Rust, Python and gRPC server for blazing-faset text generation inference.
from langchain_huggingface import HuggingFaceEndpoint
API Reference:HuggingFaceEndpoint
Installation and Setupโ
To use, you should have the huggingface_hub
python package installed.
%pip install --upgrade --quiet huggingface_hub
# get a token: https://huggingface.co/docs/api-inference/quicktour#get-your-api-token
from getpass import getpass
HUGGINGFACEHUB_API_TOKEN = getpass()
import os
os.environ["HUGGINGFACEHUB_API_TOKEN"] = HUGGINGFACEHUB_API_TOKEN