Prabhjotschugh commited on
Commit
7f48d7f
·
verified ·
1 Parent(s): 906c0e0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +125 -1
README.md CHANGED
@@ -7,6 +7,130 @@ sdk: gradio
7
  sdk_version: 4.44.0
8
  app_file: app.py
9
  pinned: false
 
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  sdk_version: 4.44.0
8
  app_file: app.py
9
  pinned: false
10
+ short_description: A web-based Optical Character Recognition (OCR) application
11
  ---
12
 
13
+ # TextVision OCR Project
14
+
15
+ ## Overview
16
+
17
+ TextVision is a web-based Optical Character Recognition (OCR) application that extracts text from images containing both Hindi and English text. The application also supports keyword search functionality to highlight specific words within the extracted text. It is built with a simple, intuitive interface and supports five languages: Hindi, English, Spanish, French, and Punjabi.
18
+
19
+ This project was developed as part of an assignment for a job application.
20
+
21
+ Live Demo: [TextVision on Hugging Face Spaces](https://huggingface.co/spaces/Prabhjotschugh/OCR-TextVision)
22
+
23
+ ## Features
24
+
25
+ - **Image Upload**: Upload an image and extract text using OCR.
26
+ - **Multi-language Support**: Supports Hindi, English, Spanish, French, and Punjabi.
27
+ - **Keyword Search**: Search for specific keywords in the extracted text, with results highlighted if the keyword is found.
28
+ - **User-friendly Interface**: Built using Gradio, offering an intuitive and simple user experience.
29
+
30
+ ## Technology Stack
31
+
32
+ - **Python 3.9+**
33
+ - **Gradio 3.50.2** for the web interface
34
+ - **PyTesseract 0.3.10** for OCR functionality
35
+ - **Pillow 10.0.1** for image processing
36
+ - **Tesseract OCR 5.3.1** as the OCR engine
37
+
38
+ ## Setup and Installation (Windows)
39
+
40
+ ### Installation Steps
41
+
42
+ 1. **Clone or Download the Repository**:
43
+ - Using Git:
44
+ ```bash
45
+ git clone https://huggingface.co/spaces/Prabhjotschugh/OCR-TextVision
46
+ cd OCR-TextVision
47
+ ```
48
+ - Alternatively, download the ZIP from Hugging Face and extract it.
49
+
50
+ 2. **Set up a Virtual Environment** (recommended):
51
+ ```bash
52
+ python -m venv venv
53
+ venv\Scripts\activate
54
+ ```
55
+
56
+ 3. **Install Required Python Packages**:
57
+ ```bash
58
+ pip install -r requirements.txt
59
+ ```
60
+
61
+ 4. **Install Tesseract OCR**:
62
+ - Download the Tesseract installer from [UB Mannheim](https://github.com/UB-Mannheim/tesseract/wiki).
63
+ - Install it and note the installation path (default: `C:\Program Files\Tesseract-OCR`).
64
+ - Add Tesseract to your system PATH:
65
+ - Search for "Environment Variables" in the Start menu.
66
+ - Under "System variables", find "Path", click "Edit", and add the Tesseract installation path.
67
+
68
+ 5. **Install Language Data for Tesseract**:
69
+ - Download language data files for Hindi (hin), Spanish (spa), French (fra), and Punjabi (pan) from [Tesseract GitHub](https://github.com/tesseract-ocr/tessdata).
70
+ - Place them in the `tessdata` folder of your Tesseract installation directory.
71
+
72
+ 6. **Configure the Application**:
73
+ - Open `app.py` in a text editor.
74
+ - Find the line:
75
+ ```python
76
+ pytesseract.pytesseract.tesseract_cmd = '/usr/bin/tesseract'
77
+ ```
78
+ - Replace it with:
79
+ ```python
80
+ pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
81
+ ```
82
+
83
+ ## Running the Application
84
+
85
+ 1. Open a command prompt in the project directory.
86
+
87
+ 2. Activate the virtual environment (if using one):
88
+ ```bash
89
+ venv\Scripts\activate
90
+ ```
91
+
92
+ 3. Start the application:
93
+ ```bash
94
+ python app.py
95
+ ```
96
+
97
+ 4. Open a web browser and navigate to `http://localhost:7860` to access the web interface.
98
+
99
+ ## Usage Instructions
100
+
101
+ 1. **Upload an Image**:
102
+ - Click on the image upload area or drag and drop an image file.
103
+ - Supported formats: JPEG, PNG, and other common image formats.
104
+
105
+ 2. **Extract Text**:
106
+ - After uploading the image, click "Extract Text."
107
+ - The extracted text will be displayed in the output area.
108
+
109
+ 3. **Keyword Search**:
110
+ - Check the "Do you want to search for a keyword?" box.
111
+ - Enter a keyword, then click "Search Keyword."
112
+ - The keyword, if found, will be highlighted in the extracted text.
113
+
114
+ 4. **Clear Results**:
115
+ - Click "Clear" to reset the interface and upload a new image.
116
+
117
+
118
+ ## Example Outputs
119
+
120
+
121
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6522888cb903b175b0db01e7/wJMcAeD6uvExq874H8RdC.png)
122
+
123
+
124
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6522888cb903b175b0db01e7/krnEemdDfYI8XbBC1hZxJ.png)
125
+
126
+
127
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6522888cb903b175b0db01e7/r7VuUWysnreYGeju7P4aP.png)
128
+
129
+
130
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6522888cb903b175b0db01e7/2O4jH3iL5zAi-XPJBKuQB.png)
131
+
132
+
133
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6522888cb903b175b0db01e7/3Y256ZpWkT4jqMPO9tiMP.png)
134
+
135
+
136
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6522888cb903b175b0db01e7/7bz16oGtOdfAIs_hj5e3V.png)