Skip to content

SouvickC/Snap_Translate

Repository files navigation

Screen Translator for Windows - Snap Translate

A technical utility for localized screen region OCR and translation leveraging high-speed inference on the Groq platform.

alt text

🧬 Technical Overview

This tool performs zero-shot OCR and context-aware translation by pipe-lining screen-captured buffers directly into a Multimodal Large Language Model (MLLM).

Core Stack

  • Inference Server: Groq Cloud (LPU™ Inference Engine)
  • Primary Model: meta-llama/llama-4-scout-17b-16e-instruct
  • Frontend: Python tkinter (Region selection & result rendering)
  • Image Processing: pyautogui + PIL (Pillow)
  • Standard: JSON-mode structured output for precise UI mapping

⚙️ Requirements & Environment

  • Platform: Windows 10/11
  • Python: 3.8+
  • Dependencies:
    • groq: API client
    • pyautogui: Screenshot capture
    • pillow: Image manipulation
    • python-dotenv: Environment configuration

🛠️ Configuration

Create a .env file in the root directory:

GROQ_API_KEY=gsk_your_api_key_here
GROQ_MODEL=meta-llama/llama-4-scout-17b-16e-instruct
TARGET_LANGUAGE=English

🚀 Technical Workflow

  1. Region Acquisition: RegionSelector (extending tk.Tk) creates a transparent fullscreen overlay to capture $(x, y, w, h)$ coordinates.
  2. Buffer Processing: pyautogui.screenshot generates a byte-stream, encoded to Base64 (PNG format).
  3. Inference: A vision-language request is dispatched to Groq. The model performs concurrent OCR, sentence reconstruction, and translation.
  4. Structured Parsing: The MLLM returns a JSON object: [{ "original": str, "translated": str }].
  5. Display: Results are rendered in a non-modal ScrolledText widget for readability.

📦 Usage

  1. Install dependencies: pip install -r requirements.txt
  2. Run the application: Execute Run_Translator.bat or run python translate_screenshot.py directly.

About

A desktop tool that captures any screen region and instantly translates the extracted text using VLM

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors