-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement HuggingFaceVisualQuestionAnsweringRemoteInferencePromptSchema
# Implement HuggingFaceVisualQuestionAnsweringRemoteInferencePromptSchema For #1392 This will add the prompt schema so that visual question answering prompts have the nice UI for input and settings
- Loading branch information
Ryan Holinshead
committed
Mar 4, 2024
1 parent
559a757
commit 53933ac
Showing
2 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
...rc/shared/prompt_schemas/HuggingFaceVisualQuestionAnsweringRemoteInferencePromptSchema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { PromptSchema } from "../../utils/promptUtils"; | ||
|
||
export const HuggingFaceVisualQuestionAnsweringRemoteInferencePromptSchema: PromptSchema = | ||
{ | ||
// See https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/inference/_client.py#L1780 for supported params. | ||
// The settings below are supported settings specified in the HuggingFaceVisualQuestionAnsweringRemoteInference refine_completion_params implementation. | ||
input: { | ||
type: "object", | ||
required: ["attachments", "data"], | ||
properties: { | ||
attachments: { | ||
type: "array", | ||
items: { | ||
type: "attachment", | ||
required: ["data"], | ||
mime_types: ["image/*"], | ||
properties: { | ||
data: { | ||
type: "string", | ||
}, | ||
}, | ||
}, | ||
max_items: 1, | ||
}, | ||
data: { | ||
// The question to ask about the image | ||
type: "string", | ||
}, | ||
}, | ||
}, | ||
model_settings: { | ||
type: "object", | ||
properties: { | ||
model: { | ||
type: "string", | ||
description: `Hugging Face model to use. Can be a model ID hosted on the Hugging Face Hub or a URL | ||
to a deployed Inference Endpoint`, | ||
default: "dandelin/vilt-b32-finetuned-vqa", | ||
}, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters