groq-ocr
Version:
a library to run OCR with Groq provided models.
34 lines (33 loc) • 1.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const commander_1 = require("commander");
const dotenv_1 = require("dotenv");
const index_1 = require("./index");
(0, dotenv_1.config)();
commander_1.program
.name("groq-ocr")
.description("CLI tool to perform OCR using Groq models")
.version("1.0.1")
.requiredOption("-f, --file <path>", "Path to image or PDF file")
.option("-k, --api-key <key>", "Groq API key (defaults to GROQ_API_KEY env variable)")
.option("-m, --model <model>", "Model to use (llama-3.2-11b-vision-preview or llama-3.2-90b-vision-preview)")
.option("-j, --json", "Output in JSON format instead of markdown")
.parse();
const options = commander_1.program.opts();
async function main() {
try {
const result = await (0, index_1.ocr)({
filePath: options.file,
apiKey: options.apiKey,
model: options.model,
jsonMode: options.json || false,
});
console.log(result);
}
catch (error) {
console.error("Error:", error.message);
process.exit(1);
}
}
main();