Spaces:
Sleeping
Sleeping
Update README.md
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150# π DualTextOCRFusion**DualTextOCRFusion** is a web-based Optical Character Recognition (OCR) application that allows users to upload images containing both Hindi and English text, extract the text, and search for keywords within the extracted text. The app uses advanced models like **ColPaliβs Byaldi + Qwen2-VL** or **General OCR Theory (GOT)** for multilingual text extraction.## Features- **Multilingual OCR**: Extract text from images containing both **Hindi** and **English**.- **Keyword Search**: Search for specific keywords in the extracted text.- **User-Friendly Interface**: Simple, intuitive interface for easy image uploading and searching.- **Deployed Online**: Accessible through a live URL for easy use.## Technologies Used- **Python**: Backend logic.- **Streamlit**: For building the web interface.- **Huggingface Transformers**: For integrating OCR models (Qwen2-VL or GOT).- **PyTorch**: For deep learning inference.- **Pytesseract**: Optional OCR engine.- **OpenCV**: For image preprocessing.## Project Structure```DualTextOCRFusion/ββββ app.py # Main Streamlit applicationβββ ocr.py # Handles OCR extraction using the selected modelβββ .gitignore # Files and directories to ignore in Gitβββ .streamlit/β βββ config.toml # Streamlit theme configurationβββ requirements.txt # Dependencies for the projectβββ README.md # This file```## How to Run Locally### Prerequisites- Python 3.8 or above installed on your machine.- Tesseract installed for using `pytesseract` (optional if using Huggingface models). You can download Tesseract from [here](https://github.com/tesseract-ocr/tesseract).### Steps1. **Clone the Repository**:```bashgit clone https://github.com/yourusername/dual-text-ocr-fusion.gitcd dual-text-ocr-fusion```2. **Install Dependencies**:Make sure you have the required dependencies by running the following:```bashpip install -r requirements.txt```3. **Run the Application**:Start the Streamlit app by running the following command:```bashstreamlit run app.py```4. **Open the App**:Once the server starts, the app will be available in your browser at:```http://localhost:8501```### Usage1. **Upload an Image**: Upload an image containing Hindi and English text in formats like JPG, JPEG, or PNG.2. **View Extracted Text**: The app will extract and display the text from the image.3. **Search for Keywords**: Enter any keyword to search within the extracted text.## DeploymentThe app is deployed on **Streamlit Sharing** and can be accessed via the live URL:**[Live Application](https://your-app-link.streamlit.app)**## Customization### Changing the OCR ModelBy default, the app uses the **Qwen2-VL** model, but you can switch to the **General OCR Theory (GOT)** model by editing the `ocr.py` file.- **For Qwen2-VL**:```pythonfrom ocr import extract_text_byaldi```- **For General OCR Theory (GOT)**:```pythonfrom ocr import extract_text_got```### Custom UI ThemeYou can customize the look and feel of the application by modifying the `.streamlit/config.toml` file. Adjust colors, fonts, and layout options to suit your preferences.## Example ImagesHere are some sample images you can use to test the OCR functionality:1. **Sample 1**: A document with mixed Hindi and English text.2. **Sample 2**: An image with only Hindi text for multilingual OCR testing.## ContributingIf you'd like to contribute to this project, feel free to fork the repository and submit a pull request. Follow these steps:1. Fork the project.2. Create a feature branch:```bashgit checkout -b feature-branch```3. Commit your changes:```bashgit commit -am 'Add new feature'```4. Push to the branch:```bashgit push origin feature-branch```5. Open a pull request.## LicenseThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.## Credits- **Streamlit**: For the easy-to-use web interface.- **Huggingface Transformers**: For the powerful OCR models.- **Tesseract**: For optional OCR functionality.- **ColPali & GOT Models**: For the multilingual OCR support.12345678910---title: "DualTextOCRFusion"emoji: "π"colorFrom: graycolorTo: bluesdk: streamlitsdk_version: "{{2.1.1}}"app_file: app.pypinned: false---
README.md+10-150