YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
moving unstructured to integrations folder
matthew-heartful2b05a7c32451
diff --git a/screenpipe-vision/src/utils.rs b/screenpipe-vision/src/utils.rsindex 6041eb0b4..3fc006161 100644--- a/screenpipe-vision/src/utils.rs+++ b/screenpipe-vision/src/utils.rs@@ -1,16 +1,12 @@use crate::core::MaxAverageFrame; // Assuming core.rs is in the same crate under the `core` module-use image::codecs::png::PngEncoder;use image::DynamicImage;-use image::ImageEncoder;use image_compare::{Algorithm, Metric, Similarity}; // Added import for Similarityuse log::{debug, error};-use reqwest::multipart::{Form, Part};use rusty_tesseract::{Args, DataOutput, Image}; // Added import for Args, Image, DataOutputuse serde_json;use std::collections::HashMap;use std::fs::{self, File};use std::hash::{DefaultHasher, Hash, Hasher};-use std::io::Cursor; // Import Cursor for wrapping Vec<u8>use std::io::Write;use std::path::PathBuf;use std::sync::Arc;@@ -245,64 +241,6 @@ pub async fn save_text_files(}}-pub async fn perform_ocr_cloud(image: &DynamicImage) -> (String, DataOutput, String) {- let api_key = "CDMIN4mAq1TDtufPY2HpIIRdJkHqi6".to_string();- let api_url = "https://api.unstructuredapp.io/general/v0/general".to_string();-- let mut buffer = Vec::new();- let mut cursor = Cursor::new(&mut buffer); // Wrap Vec<u8> in Cursor- PngEncoder::new(&mut cursor)- .write_image(- image.as_bytes(),- image.width(),- image.height(),- image.color().into(), // Convert ColorType to ExtendedColorType- )- .unwrap();-- let part = Part::bytes(buffer)- .file_name("image.png".to_string())- .mime_str("image/png")- .unwrap();-- let form = Form::new()- .part("files", part)- .text("strategy", "auto")- .text("coordinates", "true");-- let client = reqwest::Client::new();- let response = client- .post(&api_url)- .header("accept", "application/json")- .header("unstructured-api-key", &api_key)- .multipart(form)- .send()- .await- .unwrap();-- let response_text = if response.status().is_success() {- response.text().await.unwrap()- } else {- panic!("Error: {}", response.status());- };-- let json_output = response_text.clone();- let data_output = DataOutput {- data: Vec::new(),- output: String::new(),- }; // Initialize blank DataOutput-- let parsed_response: Vec<HashMap<String, serde_json::Value>> =- serde_json::from_str(&response_text).unwrap();- let text = parsed_response- .iter()- .filter_map(|item| item.get("text").and_then(|v| v.as_str()))- .collect::<Vec<&str>>()- .join(" ");-- (text, data_output, json_output)-}-#[cfg(target_os = "windows")]pub async fn perform_ocr_windows(image: &DynamicImage) -> (String, DataOutput, String) {use windows::{@@ -351,4 +289,4 @@ pub async fn perform_ocr_windows(image: &DynamicImage) -> (String, DataOutput, S.to_string();(text, data_output, json_output)-}+}\ No newline at end of file