How coderreaper69/hindi_to_hinglish_convert works
Project type and purpose
• This is a single‐page, full-stack web application built with Streamlit.
• Purpose: take Hindi text in images or PDF files, send it to Google Gemini’s AI model for transliteration into Hinglish, and present/download the results.
File structure
• Top level:
• .devcontainer/devcontainer.json – dev container config
• main_enhanced.py – Streamlit entry point (UI/controller)
• ai_processing.py – image-based transliteration logic
• doc_file_processing.py – PDF page extraction + orchestration logic
• hindi_to_hinglish_all_code_at_once.py – monolithic earlier version
• requirements.txt – Python dependencies
• __init__.py – package marker
• image/ – static demo screenshots, templates
• No separate services or databases—everything runs in one process, hosted on Streamlit Cloud.
README for additional insights
• Components listed: Streamlit interface, Gemini API integration, PyMuPDF for PDF, BytesIO for memory-efficient file I/O, PDF generation for downloads, rate limiting.
• No persistent storage; files live in memory during session.
a. Main components
1. User’s Web Browser (Client)
2. Streamlit App (main_enhanced.py) – handles routing, UI, file uploads
3. File Handler / Orchestrator (doc_file_processing.py) – extracts PDF pages as images
4. Image Processing Module (ai_processing.py) – sends each image to Google Gemini
5. Google Gemini 2.0 Flash API (External Service)
6. PDF Generator – collects transliterated text and builds downloadable PDF
b. Relationships & data flow
• Browser → Streamlit App: upload image/PDF, UI events
• Streamlit App → File Handler: if PDF, extract pages (via PyMuPDF + BytesIO)
• Streamlit App / File Handler → Image Processing Module: pass image bytes
• Image Processing → Google Gemini API: send image, receive Hinglish text
• Image Processing → Streamlit App: return text snippets
• Streamlit App → PDF Generator: assemble pages/text into PDF stream
• Streamlit App → Browser: render text and provide download link
c. Architectural patterns
• Layered flow: UI layer → orchestration layer → processing layer → external API
• Modular code separation: single-responsibility modules for AI calls vs. PDF extraction vs. UI
• No persistent data layer
d. Key technologies
• Python/Streamlit for UI and server
• PyMuPDF (fitz) for PDF page extraction
• BytesIO for in-memory file operations
• Google Gemini 2.0 Flash AI model for transliteration
• ReportLab or similar for PDF generation (if used)