-
Image Upload and Cropping:
- Upload images in
.jpg,.jpeg, or.pngformats. - Optionally crop the image to focus on specific areas.
- Upload images in
-
Preprocessing Options:
- Apply Grayscale or Thresholding filters to enhance OCR accuracy.
-
OCR (Optical Character Recognition):
- Extract text from images using Tesseract OCR with support for multiple languages:
- English, Spanish, French, German, Italian.
- Extract text from images using Tesseract OCR with support for multiple languages:
-
AI-Generated Insights:
- Generate detailed responses based on the extracted text using Google's Generative AI.
- Customize the tone of responses: Formal, Casual, Concise, or Descriptive.
-
Download Options:
- Download the extracted text or AI-generated response as
.txtfiles.
- Download the extracted text or AI-generated response as
-
Dynamic Image Quality Feedback:
- Visualize and confirm preprocessing results to ensure optimal OCR performance.
-
Text Analysis:
- Display Word Count and Character Count for extracted text.
-
Interactive Prompts:
- Provide custom prompts for AI interaction to generate contextually relevant responses.
-
User-Friendly Design:
- Intuitive interface with clear headings, organized layouts, and easy-to-use controls.
-
Install Required Libraries:
pip install pillow pytesseract streamlit google-generativeai streamlit-cropper
-
Run the App:
streamlit run app.py
- On the left sidebar, enter your Google API Key (required for Generative AI features).
-
Upload an Image:
- Drag and drop or select an image from your local system.
-
Crop the Image (Optional):
- Adjust the cropping tool to focus on specific areas.
-
Preprocess the Image:
- Choose preprocessing options:
- None: Use the original image.
- Grayscale: Convert the image to black and white.
- Thresholding: Enhance contrast for OCR.
- Choose preprocessing options:
- Select the OCR Language in the sidebar.
- View the extracted text displayed in the "Extracted Text" section.
- Download the Text:
- Click the "Download Extracted_Text.txt" button.
- Enter a Custom Prompt to describe what you want the AI to generate.
- Choose the Response Tone (e.g., Formal, Casual, etc.).
- Click "Generate AI Response" to see the output.
- Download the Response:
- Click the "Download AI_Response.txt" button.
- Business:
- Extract and analyze text from invoices, forms, or scanned documents.
- Education:
- Generate summaries or explanations from textbook images.
- Content Creation:
- Generate creative writing or captions based on image content.
- Translation:
- Extract text in one language and use a translator for localization.
-
API Key Errors:
- Ensure your API Key is active and entered correctly in the sidebar.
-
Poor OCR Accuracy:
- Use high-quality images with clear text.
- Apply preprocessing filters like Grayscale or Thresholding.
-
Library Installation Issues:
- Ensure Python is installed, and libraries are up to date:
pip install --upgrade pytesseract pillow streamlit
- Ensure Python is installed, and libraries are up to date:
-
Image Cropping Errors:
- Use the cropping tool to focus only on areas containing text.
- Tesseract OCR: For robust text extraction capabilities.
- Google Generative AI: For AI-driven insights and responses.
- Streamlit: For a seamless, interactive user interface.
Want to add more features or improve the app? Fork the project and submit a pull request. Suggestions are welcome!
This project is licensed under the MIT License. Feel free to use, modify, and distribute it. 😊
Enjoy using the Advanced OCR and Generative AI Application! 🚀