Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT

How to get started with Hugging Face in Qlik Application Automation

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
hervebiey
Support
Support

How to get started with Hugging Face in Qlik Application Automation

Last Update:

May 10, 2022 8:58:49 AM

Updated By:

Emile_Koslowski

Created date:

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.

Contents

The primary use-case of the Hugging Face connector in Qlik Application Automation is NLP. We have blocks focused on the following tasks:

  1. Translation
  2. Summarization
  3. Question Answering
  4. Table Question Answering
  5. Conversation
  6. Other 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:

Emile_Koslowski_0-1652172842831.png

Executing the above block gives the following result: 

Emile_Koslowski_1-1652172901327.png

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:

Emile_Koslowski_2-1652173350909.png

Executing the above summarization task gives the following result:

Emile_Koslowski_3-1652173404413.png

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:

 

Emile_Koslowski_4-1652174168522.png

Executing the above block gives the following result:

Emile_Koslowski_5-1652174204092.png

 

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:

Emile_Koslowski_0-1652180581265.png

  1. Use the Get Straight Table Data block from the Qlik Cloud Services connector to retrieve the table's data. This block will return the data as a JSON list in which every object represents a record from the table.
  2. Add the Run Table Question Answering Task block from the Hugging Face connector, specify the Model & Submodel you want to use and start building the Table input parameter as follows:
    1. Click 'Add Item' for every column in the table that should be used as context.
    2. Specify the right column name for each item's key.
    3. Configure the output from the Get Straight Table Data block as input for each item's Value parameter. Select the corresponding column name and make sure to use the 'Select all <collumname>'s from list GetStraightTableData' option. See the images below for more information:
      Select the output from the Get Straight Table Data block.Select the output from the Get Straight Table Data block.

       

      Select the right column nameSelect the right column name

       

      Use the 'Select all' optionUse the 'Select all' option 
  3.  Specify the question in the Query parameter.

Running the above example gives the following result:

Emile_Koslowski_5-1652181805922.png

 

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:

Emile_Koslowski_0-1652182495260.png

Executing the above example gives the following result:

Emile_Koslowski_1-1652182531299.png

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 

Tags (1)
Labels (2)
Version history
Last update:
‎2022-05-10 08:58 AM
Updated by: