Skip to content

https://www.w3.org/users/176311/ #2798

Description

const fs = require('fs');

async function recognizeNrcCard(imagePath) {
// Convert local image file to Base64 string
const imageBuffer = fs.readFileSync(imagePath);
const base64Image = imageBuffer.toString('base64');

const payload = {
image: base64Image // Alternatively use "url": "https://..."
};

try {
const response = await fetch('https://myhuaweicloud.com', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Auth-Token': 'YOUR_HUAWEI_CLOUD_TOKEN'
},
body: JSON.stringify(payload)
});

if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);

const result = await response.json();
console.log("Extracted NRC Data:", result);
return result;

} catch (error) {
console.error("OCR Request Failed:", error);
}
}
Describe the bug
A clear and concise description of what the bug is.

Expected behavior
A clear and concise description of what you expected to happen.

Minimal reproducible OpenAPI snippet(if possible)

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions