Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
May 10, 2022 8:58:49 AM
Sep 27, 2021 7:54:24 AM
Hugging Face is an online platform that hosts pre-trained machine learning models to complete tasks ranging from natural language processing (NLP) to computer vision and audio.
This article gives an overview of the available blocks in the Hugging Face connector in Qlik Application Automation. And how they can be configured to leverage the pre-trained models in your automations.
The primary use-case of the Hugging Face connector in Qlik Application Automation is NLP. We have blocks focused on the following tasks:
Translation
Translation is an NLP task that focuses on translating text from one language to another. Every model is trained for specific languages, in most cases, you'll be able to deduce these languages from the model's name, if you're unsure, go to the model's detail page on Hugging Face and review the "Model card". The Helsinki-NLP/opus-mt-fr-en model, for example, will translate from French (fr) to English (en). If you want to translate in the other direction, you'll need to use a different model.
For an overview of the available translation models, see Hugging Face - Translation models.
Use the Run Translation Task block to translate texts in an automation, example:
Executing the above block gives the following result:
Summarization
This task allows you to generate a text summary based on a bigger text that was provided as input.
For an overview of the available summarization models, see Hugging Face - Summarization models.
Use the Run Summarization Task block to summarize texts in an automation, for example:
Executing the above summarization task gives the following result:
Question answering
In question answering tasks, a model will answer a question based on a given context. The question and context are both inputs in the model. For regular question answering, the context is a text. If you want to supply a table of data as context, see Table Question Answering (next topic).
For an overview of the available Question Answering models, see Hugging Face - Table Question Answering models.
Use the Run Question Answering Task block to perform this task in an automation, for example:
Executing the above block gives the following result:
Table Question Answering
This task is similar to Question Answering. The difference is that the context to answer questions is not taken from a text but from a table (dictionary).
For an overview of the available Table Question Answering models, see Hugging Face - Table Question Answering models.
Use the Run Table Question Answering Task block to perform this task in an automation. In the below example, we'll use data from a Straight Table as the context for the question.
Example table:
Running the above example gives the following result:
Conversation
Conversation tasks generate dialogue responses for conversations. It can be used to start a conversation or to continue an existing conversation by specifying the previous questions and answers.
For an overview of the available conversation models, see Hugging Face - Conversation models.
Use the Run Question Answering Task block to perform this task in an automation, for example:
Executing the above example gives the following result:
Other tasks
Currently, the Hugging Face connector has only a selection of tasks implemented as dedicated blocks. Hugging Face has more tasks available than the five we mentioned in this article. If you want to perform a task that has no dedicated block in automations, you can use the Raw Inference API Request block. This block allows you to make API requests to Hugging Face's Inference API. Note that not all models are available in this Inference API, verify if the model is available by reviewing the 'Model card' in the Hugging Face platform.
More information on working with the Raw Inference API Request block and the Raw API Request block can be found here: How to use the Raw API Request blocks