Skip to content

Latest commit

 

History

History
73 lines (48 loc) · 2.21 KB

README.md

File metadata and controls

73 lines (48 loc) · 2.21 KB

OCR Image Conversion Tool

This FastAPI-based tool performs Optical Character Recognition (OCR) on images, allowing conversion to text or PDF.

Features

  • Img2Text: Reads text from an uploaded image.
  • Img2pdf: Converts an image to a PDF with the extracted text.

Prerequisites

Before running the project, make sure you have the following installed on your system:

Installation

  1. Download Tesseract OCR for Windows from https://community.chocolatey.org/packages/tesseract-ocr#files. Choose the tesseract-ocr-w64-setup package.

  2. Install Tesseract OCR by following the installation instructions provided on the download page.

  3. Add Tesseract to your system PATH:

    • Open the Control Panel.
    • Click on "System and Security."
    • Click on "System."
    • Click on "Advanced system settings" on the left.
    • Click on the "Environment Variables" button.
    • Under "System variables," find and select the "Path" variable, then click on "Edit."
    • Click on "New" and add the path to the Tesseract installation directory (usually C:\Program Files\Tesseract-OCR).
  4. Open a terminal and navigate to the project directory.

  5. Create a virtual environment (optional but recommended):

    python -m venv venv
    
  6. Activate the virtual environment:

    • On Windows:

      .\venv\Scripts\activate
      
    • On Linux/macOS:

      source venv/bin/activate
      
  7. Install the required Python packages:

    pip install -r requirements.txt
    

Run the Application

Once the installation is complete, you can run the FastAPI application using the following command:

uvicorn main:app --reload

Visit http://127.0.0.1/docs in your browser to access the FastAPI Swagger documentation and test the OCR functionality.

Usage

Follow the API documentation to interact with the OCR endpoint and extract text from images.

License

This project is licensed under the MIT License. Feel free to use and modify as needed.