text_detection / README.md
AlBaraa63's picture
Simple clean UI version
d5841ad
---
title: Text Detection Demo
emoji: πŸ“
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: 5.49.1
app_file: app.py
pinned: false
license: apache-2.0
---
# πŸ“ Text Detection Demo
Extract text from any image using OCR (Optical Character Recognition).
## 🎯 What It Does
Upload an image β†’ AI extracts the text β†’ Copy and use!
## πŸš€ Try it Live
**Demo:** https://huggingface.co/spaces/AlBaraa63/text_detection
## πŸ“ Files
```
text_detection/
β”œβ”€β”€ app.py # Gradio web demo
β”œβ”€β”€ main.py # CLI version
β”œβ”€β”€ preprocessing.py # Image processing helpers
β”œβ”€β”€ requirements.txt # Dependencies
β”œβ”€β”€ packages.txt # System dependencies
└── README.md # This file
```
## �️ Setup
### 1. Install Tesseract OCR
- **Windows:** Download from [here](https://github.com/UB-Mannheim/tesseract/wiki)
- Install to: `C:\Program Files\Tesseract-OCR`
### 2. Install Python Packages
```bash
pip install -r requirements.txt
```
Or manually:
```bash
pip install opencv-python pytesseract numpy
```
### 3. Test Installation
```bash
python test_tesseract.py
```
## πŸš€ Usage
### Simple - Run and Enter Path
```bash
python main.py
```
Then enter your image path when asked.
### Example
```bash
python main.py
# Enter: inputs/image.png
```
## πŸ“ Example
**Input Image:** Screenshot with text
**Output:** Text file with detected text
```
Image: image.png
Size: 869 x 296 pixels
DETECTED TEXT:
Mix - antent - homesick (super slowed)
Mixes are playlists YouTube makes for you
βœ… Text saved to: output.txt
```
## πŸŽ“ How It Works
1. **Load Image** - Read the image file
2. **Preprocess** - Convert to grayscale and enhance
3. **OCR** - Extract text using Tesseract
4. **Save** - Write text to output.txt
## πŸ“Š What's Included
- **1 sample image** in `inputs/` folder for testing
- Works with any image format (PNG, JPG, etc.)
- Clean and minimal - perfect for learning!
## πŸ’‘ Tips
- Works best with clear, high-contrast images
- Screenshots work great
- Photos might need better lighting
- Larger images = better accuracy
## οΏ½ Next Steps
Once you understand this basic version, you can:
- Add preprocessing options
- Batch process multiple images
- Add confidence scores
- Try different languages
---
*Simple text detection for learning* πŸŽ“