Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

llama-ocr

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

llama-ocr - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

25

dist/index.js

@@ -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, }) {

2

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc