Hugging Face
Run text generation, classification, and image classification models on Hugging Face.
On this page
Connect
Auth type: API key (secret_text). Paste the API key (or token) from the provider's settings into the connect dialog. It is encrypted at rest and only decrypted on the server when an action runs.
- In the editor: Backend panel, Integrations tab, then Connect. This connects it for the project.
- For every project in a workspace: Workspace settings, Integrations.
- Owners and admins choose which integrations members may connect in the admin panel (Integrations tab), and can attach their own OAuth app there.
Call it from a workflow
Pass the action name and its input. The call resolves with { success, output, error? }; a missing connection resolves with success false and the reason. See ctx.integrations.invoke and ctx.integrations.call.
// .workflow.js (native ctx)
export async function run(ctx) {
const res = await ctx.integrations.invoke("hugging_face", "image_classification", {
"classificationMode": "standard",
"useCase": "moderation",
"model": "<model>",
"imageSource": "upload",
"imageFile": "<image file>",
"imageUrl": "<image url>",
"customCategories": []
});
if (!res.success) throw new Error(res.error);
ctx.log.info("Hugging Face answered", { output: res.output });
}// defineWorkflow module (@app/sdk ctx)
import { defineWorkflow } from "@app/sdk";
export default defineWorkflow({
id: "hugging-face-image-classification",
name: "Hugging Face: Image Classification",
description: "Calls Hugging Face when a row is created.",
trigger: { type: "entity_event", entity: "tickets", event: "created" },
async run(ctx, event) {
const res = await ctx.integrations.call("hugging_face", {
"action": "image_classification",
"classificationMode": "standard",
"useCase": "moderation",
"model": "<model>",
"imageSource": "upload",
"imageFile": "<image file>",
"imageUrl": "<image url>",
"customCategories": []
}) as { success: boolean; error?: string };
if (!res.success) throw new Error(res.error);
},
});curl -X POST "$APP_ORIGIN/__appbricx/connector-proxy/hugging_face/image_classification" \
-H "Authorization: Bearer $APP_KEY" \
-H "content-type: application/json" \
-d '{"props":{"classificationMode":"standard","useCase":"moderation","model":"<model>","imageSource":"upload","imageFile":"<image file>","imageUrl":"<image url>","customCategories":[]}}'Actions
image_classificationin catalog
Image Classification. Classify images with pre-trained models or custom categories - perfect for content moderation, automated tagging, and smart asset management
| Input | Type | Description |
|---|---|---|
classificationModerequired | one of "standard" | "zero_shot" | How do you want to classify your images? |
useCaserequired | one of "moderation" | "general" | "people" | "creative" | "business" | "search" | What type of image classification do you need? |
modelrequired | id (picked from your account) | Select the best model for your use case |
imageSourcerequired | one of "upload" | "url" | How do you want to provide the image? |
imageFilerequired | file | Upload an image file for classification (JPG, PNG, WebP) |
imageUrlrequired | text | URL of the image to classify |
customCategoriesrequired | array | Enter the categories you want to classify the image into (e.g., "dog", "cat", "bird") |
hypothesisTemplateoptional | text | Template for classification (advanced). Default: "This image shows {}" |
topKoptional | number | Maximum number of classification results to return (1-20) |
confidenceThresholdoptional | number | Minimum confidence score for results (0.0-1.0) |
outputFormatoptional | one of "business" | "technical" | "analytics" | "comprehensive" | How to structure the classification results |
text_classificationin catalog
Text Classification. Classify text into categories using Hugging Face models - includes zero-shot classification for custom categories
| Input | Type | Description |
|---|---|---|
classificationModerequired | one of "zero-shot" | "pretrained" | "search" | Choose your classification approach |
zeroShotModeloptional | one of "facebook/bart-large-mnli" | "sileod/deberta-v3-base-tasksource-nli" | "MoritzLaurer/DeBERTa-v3-base-mnli-fever-anli" | "lxyuan/distilbert-base-multilingual-cased-sentiments-student" | Model for classifying into your custom categories |
customLabelsoptional | long text | Enter categories separated by commas (e.g., "customer support, sales inquiry, spam, billing question") |
pretrainedModeloptional | one of "cardiffnlp/twitter-roberta-base-sentiment-latest" | "distilbert/distilbert-base-uncased-finetuned-sst-2-english" | "nlptown/bert-base-multilingual-uncased-sentiment" | "ProsusAI/finbert" | "yiyanghkust/finbert-tone" | "facebook/roberta-hate-speech-dynabench-r4-target" | "tomh/toxigen_hatebert" | "Xuhui/ToxDect-roberta-large" | "atulgupta002/banking_customer_service_query_intent_classifier" | "wesleyacheng/sms-spam-classification-with-bert" | Select a specialized pre-trained classification model |
searchModeloptional | id (picked from your account) | Search from all available text classification models |
textrequired | long text | The text content you want to classify |
topKoptional | number | Number of top predictions to return |
functionToApplyoptional | one of "softmax" | "sigmoid" | "none" | How to calculate confidence scores |
useCacheoptional | boolean | Use cached results for faster responses |
waitForModeloptional | boolean | Wait for model to load if not immediately available |
chat_completion
Chat Completion. Generate assistant replies using chat-style LLMs - perfect for FAQ bots, support agents, and content generation
| Input | Type | Description |
|---|---|---|
useCaserequired | one of "faq" | "content" | "chat" | "search" | What type of chat assistant are you building? |
modelrequired | id (picked from your account) | Select the best model for your use case |
conversationModerequired | one of "single" | "multi" | "template" | How do you want to build the conversation? |
userMessageoptional | long text | The user message or question to respond to |
systemPromptoptional | long text | Instructions for how the assistant should behave |
conversationHistoryoptional | array | Previous messages in the conversation (for multi-turn chat) |
templateoptional | one of "support" | "faq" | "writer" | "email" | "ecommerce" | Pre-built templates for common business scenarios |
responseLengthoptional | one of "brief" | "normal" | "detailed" | "custom" | How long should the response be? |
customMaxTokensoptional | number | Maximum number of tokens to generate |
temperatureoptional | number | How creative should responses be? (0.1 = focused, 1.0 = creative) |
topPoptional | number | Controls response diversity (0.1 = focused, 1.0 = varied) |
stopSequencesoptional | array | Text sequences that will stop generation |
frequencyPenaltyoptional | number | Reduce repetitive responses (-2.0 to 2.0) |
presencePenaltyoptional | number | Encourage diverse topics (-2.0 to 2.0) |
useCacheoptional | boolean | Use cached responses for identical requests |
waitForModeloptional | boolean | Wait for model to load if not immediately available |
create_image
Create Image. Generate stunning images from text prompts using state-of-the-art diffusion models - perfect for marketing, product design, and creative content
| Input | Type | Description |
|---|---|---|
useCaserequired | one of "speed" | "quality" | "business" | "search" | What type of image generation do you need? |
modelrequired | id (picked from your account) | Select the best model for your use case |
promptrequired | long text | Describe the image you want to generate. Be specific about style, colors, composition, and details. |
aspectRatiooptional | one of "portrait" | "landscape" | "square" | "wide" | "custom" | Choose the dimensions for your image |
customWidthoptional | number | Width in pixels (64-1024) |
customHeightoptional | number | Height in pixels (64-1024) |
negativePromptoptional | long text | Describe what you DON'T want in the image (blur, low quality, distorted, etc.) |
qualitySettingsoptional | one of "fast" | "balanced" | "quality" | "maximum" | "custom" | Balance between image quality and generation time |
customStepsoptional | number | Number of denoising steps (1-100) |
guidanceScaleoptional | number | How closely to follow the prompt (1-20). Higher values = more prompt adherence but may reduce creativity. |
seedoptional | number | Set a seed for reproducible results. Leave empty for random generation. |
scheduleroptional | one of "DPM++2MKarras" | "EulerA" | "DDIM" | "LMS" | Advanced: Choose the noise scheduler algorithm |
document_question_answering
Document Question Answering. Answer questions from document images using Hugging Face models
| Input | Type | Description |
|---|---|---|
modelrequired | one of "impira/layoutlm-document-qa" | "microsoft/layoutlmv3-base" | "nielsr/layoutlmv2-finetuned-docvqa" | Hugging Face document question answering model |
imagerequired | file | Image of the document to analyze (invoice, contract, etc.) |
questionrequired | text | Question to ask about the document (e.g., 'What is the invoice total?') |
top_koptional | number | Number of top answers to return |
max_answer_lenoptional | number | Maximum length of predicted answers |
handle_impossible_answeroptional | boolean | Whether to accept 'impossible' as an answer when no answer is found |
langoptional | one of "en" | "es" | "fr" | "de" | "it" | "pt" | Language to use for OCR text extraction |
use_cacheoptional | boolean | Use cached results if available |
wait_for_modeloptional | boolean | Wait for model to load if not ready |
language_translation
Language Translation. Translate text between languages using specialized Hugging Face translation models
| Input | Type | Description |
|---|---|---|
modelrequired | id (picked from your account) | Select a translation model or search from 7000+ available models |
customModeloptional | text | Alternative: Enter any Hugging Face translation model ID directly (e.g., Helsinki-NLP/opus-mt-ja-en) |
textrequired | long text | The text content you want to translate |
sourceLanguageoptional | text | Source language code (e.g., "en", "es", "fr"). Only needed for multilingual models that support multiple language pairs. |
targetLanguageoptional | text | Target language code (e.g., "fr", "de", "zh"). Only needed for multilingual models that support multiple language pairs. |
cleanUpSpacesoptional | boolean | Remove potential extra spaces in the translation output |
maxLengthoptional | number | Maximum length of the translated text (leave empty for default) |
useCacheoptional | boolean | Use cached results if available for faster responses |
waitForModeloptional | boolean | Wait for model to load if not immediately available |
object_detection
Object Detection. Detect and locate objects in images with precise bounding boxes - perfect for inventory management, content moderation, and automated tagging
| Input | Type | Description |
|---|---|---|
useCaserequired | one of "general" | "documents" | "security" | "business" | "search" | What type of object detection do you need? |
modelrequired | id (picked from your account) | Select the best model for your detection task |
imagerequired | file | Upload an image for object detection. Supports JPG, PNG, WebP formats. |
confidenceThresholdoptional | number | Minimum confidence score for detections (0.1-0.9). Higher values = fewer but more accurate detections. |
maxDetectionsoptional | number | Maximum number of objects to detect (1-100) |
filterSettingsoptional | one of "high_confidence" | "balanced" | "all_results" | "custom" | How to handle detection results |
outputFormatoptional | one of "business" | "technical" | "analytics" | "comprehensive" | How to structure the detection results |
text_summarization
Text Summarization. Generate abstractive summaries of long text using Hugging Face models - optimized for business content
| Input | Type | Description |
|---|---|---|
contentTyperequired | one of "news" | "email" | "meeting" | "general" | "medical" | "multilingual" | "search" | What type of content are you summarizing? |
modelrequired | id (picked from your account) | Select the best model for your content type |
textrequired | long text | The long text content you want to summarize (most models work best with 512-1024 tokens) |
summaryLengthoptional | one of "brief" | "medium" | "detailed" | "custom" | How long should the summary be? |
customMinLengthoptional | number | Minimum number of tokens for the summary |
customMaxLengthoptional | number | Maximum number of tokens for the summary |
cleanUpSpacesoptional | boolean | Remove extra spaces and clean up formatting |
truncationStrategyoptional | one of "do_not_truncate" | "longest_first" | "only_first" | "only_second" | How to handle text that exceeds model limits |
useCacheoptional | boolean | Use cached results for faster responses |
waitForModeloptional | boolean | Wait for model to load if not immediately available |
Details
- Id
hugging_face- Category
- AI and ML
- Tags
- ai, huggingface, ml, open-source, models
- Package
@activepieces/piece-hugging-face@0.1.3- Tier
- Built in