Using Document Analysis
Request
URL: https://ai.purlabs.xyz/hugging-face/documents/scan
Request method: POST
TS Interface
interface Request {
document: string;
prompt: string;
};Example JSON Request Body
{
"document": "https://online.visual-paradigm.com/repository/images/4367fbb4-b023-4e4f-b910-8db451358a3b/recipe-cards-design/simple-pancake-recipe-card.png",
"prompt": "What is the first step?"
}Response
TS Interface
interface Response {
id: string;
object: 'document.ask';
created: number;
model: 'layoutlm-document-qa';
choices: [
{
index: 0;
result: {
answer: string;
score: number;
};
finish_reason: 'stop';
};
]
};Example JSON Response
{
"id": "xgg507on82j0fdx5y6hbpqt",
"object": "document.scan",
"created": 1691963644,
"model": "layoutlm-document-qa",
"choices": [{
"index": 0,
"result": {
"answer": "Sift the dry ingredients in a bowl.",
"score": 0.39301714301109314
},
"finish_reason": "stop"
}],
"leftUsages": {}
}