Comparing version 0.0.5 to 0.0.6
@@ -9,4 +9,3 @@ "use strict"; | ||
const fs_1 = __importDefault(require("fs")); | ||
// import { fromPath } from "pdf2pic"; | ||
async function ocr({ filePath, apiKey = process.env.TOGETHER_API_KEY, model = "free", }) { | ||
async function ocr({ filePath, apiKey = process.env.TOGETHER_API_KEY, model = "Llama-3.2-90B-Vision", }) { | ||
const visionLLM = model === "free" | ||
@@ -20,24 +19,2 @@ ? "meta-llama/Llama-Vision-Free" | ||
return finalMarkdown; | ||
// if (filePath.endsWith(".pdf")) { | ||
// const options = { | ||
// density: 100, // Image density | ||
// saveFilename: "output", // Output filename | ||
// savePath: "./images", // Output directory | ||
// format: "png", // Image format: png, jpeg, etc. | ||
// width: 2550, // Desired width of the image | ||
// height: 3300, // Desired height of the image | ||
// }; | ||
// // Create a converter instance | ||
// const converter = fromPath(filePath, options); | ||
// // Convert all pages to images | ||
// await converter | ||
// .bulk(-1) | ||
// .then((resolve) => { | ||
// console.log("Images converted:", resolve); | ||
// }) | ||
// .catch((error) => { | ||
// console.error("Error converting PDF:", error); | ||
// }); | ||
// continue here by calling the getMarkDown function for each image | ||
// } | ||
} | ||
@@ -44,0 +21,0 @@ async function getMarkDown({ together, visionLLM, filePath, }) { |
{ | ||
"name": "llama-ocr", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "Image to markdown (OCR) with Llama 3.2 Vision.", | ||
@@ -5,0 +5,0 @@ "author": "Hassan El Mghari (@nutlope)", |
@@ -24,3 +24,2 @@ <div align="center"> | ||
filePath: "./trader-joes-receipt.jpg", // path to your image (soon PDF!) | ||
model: "Llama-3.2-90B-Vision", // optional, defaults to "free" | ||
apiKey: process.env.TOGETHER_API_KEY, // Together AI API key | ||
@@ -34,2 +33,4 @@ }); | ||
You can control this with the `model` option which is set to `Llama-3.2-90B-Vision` by default but can also accept `free` or `Llama-3.2-11B-Vision`. | ||
## Roadmap | ||
@@ -36,0 +37,0 @@ |
import Together from "together-ai"; | ||
import fs from "fs"; | ||
// import { fromPath } from "pdf2pic"; | ||
@@ -8,3 +7,3 @@ export async function ocr({ | ||
apiKey = process.env.TOGETHER_API_KEY, | ||
model = "free", | ||
model = "Llama-3.2-90B-Vision", | ||
}: { | ||
@@ -27,28 +26,2 @@ filePath: string; | ||
return finalMarkdown; | ||
// if (filePath.endsWith(".pdf")) { | ||
// const options = { | ||
// density: 100, // Image density | ||
// saveFilename: "output", // Output filename | ||
// savePath: "./images", // Output directory | ||
// format: "png", // Image format: png, jpeg, etc. | ||
// width: 2550, // Desired width of the image | ||
// height: 3300, // Desired height of the image | ||
// }; | ||
// // Create a converter instance | ||
// const converter = fromPath(filePath, options); | ||
// // Convert all pages to images | ||
// await converter | ||
// .bulk(-1) | ||
// .then((resolve) => { | ||
// console.log("Images converted:", resolve); | ||
// }) | ||
// .catch((error) => { | ||
// console.error("Error converting PDF:", error); | ||
// }); | ||
// continue here by calling the getMarkDown function for each image | ||
// } | ||
} | ||
@@ -55,0 +28,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45
6850
137