Introduction

In this demonstration we show Breadboard integration with the Hugging Face Inference API. The purpose of this board is to perform Text Classification.

Inputs Overview

  • API Key: Required to access the Hugging Inference API. See README Source on how to generate one for yourself.
  • Input Text: The piece of text we want to classify. For example: “I recently bought a device from your company, but it is not working as advertised. I would like to get reimbursed.”
  • Candidate Labels: The set of categories we want to classify the text against.
  • Multi-label Flag: Indicates if the labels can overlap.
  • Use Cache Flag: Speeds up requests by returning a cached response if the model has seen the inputs before.
  • Wait for Model Flag: Ensures the model fully loads before returning a response, useful for large language models.

Example Demonstration

Given the input text: “I recently bought a device from your company, but it is not working as advertised. I would like to get reimbursed.” and labels: refund, cooking, weather we expect the label to be “refund” as this is the core subject of the text.

Running the Classification

When we send the input to the API, the response confirms that “refund” is the highest-scoring label.

Conclusion

This simple example illustrates the functionality of our text classification board. In a later video, we will demonstrate a use case of this board using our Chrome Breadbaord extension.

Source

README

Board

Graph

Breadboard Web Example

Preview Mode

</<iframe src="https://breadboard-ai.web.app/?mode=build&board=https%3A%2F%2Fraw.githubusercontent.com%2FExaDev%2Fbreadboard-examples%2FHugging-Face-Clean-History%2Fsrc%2Fexamples%2Flabelling%2Fboard.json" style="width: 100%; height: 500px; border: 0;"></iframe>