Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available:
6.2.0
metadata
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
- Install to:
C:\Program Files\Tesseract-OCR
2. Install Python Packages
pip install -r requirements.txt
Or manually:
pip install opencv-python pytesseract numpy
3. Test Installation
python test_tesseract.py
π Usage
Simple - Run and Enter Path
python main.py
Then enter your image path when asked.
Example
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
- Load Image - Read the image file
- Preprocess - Convert to grayscale and enhance
- OCR - Extract text using Tesseract
- 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 π