> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-zh.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# HuggingFace Hub 集成

> 使用 LangChain Python 与 HuggingFace Hub 工具集成。

> [Huggingface Tools](https://huggingface.co/docs/transformers/v4.29.0/en/custom_tools) 支持文本输入输出，可以直接使用 `load_huggingface_tool` 函数加载。

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
# Requires transformers>=4.29.0 and huggingface_hub>=0.14.1
pip install -qU  transformers huggingface_hub > /dev/null
```

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
pip install -qU  langchain-community
```

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain_community.agent_toolkits.load_tools import load_huggingface_tool

tool = load_huggingface_tool("lysandre/hf-model-downloads")

print(f"{tool.name}: {tool.description}")
```

```text theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
model_download_counter: This is a tool that returns the most downloaded model of a given task on the Hugging Face Hub. It takes the name of the category (such as text-classification, depth-estimation, etc), and returns the name of the checkpoint
```

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
tool.run("text-classification")
```

```text theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
'facebook/bart-large-mnli'
```

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
```

***

<div className="source-links">
  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/i18n\zh-CN\oss\python\integrations\tools\huggingface_tools.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>

  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>
</div>
