An AI-powered web application that converts ancient Tamil Brahmi script from images into modern, readable Tamil text. This tool leverages the multimodal capabilities of Google's Gemini model to perform Optical Character Recognition (OCR) and script conversion.
- Secure API Key Handling: Prompts for an API key if not provided, storing it only for the current session.
- Intuitive Image Upload: Supports both drag-and-drop and traditional file selection.
- Instant Image Preview: See the uploaded image directly in the interface before conversion.
- AI-Powered Conversion: Utilizes the Google Gemini API for accurate OCR and script transformation.
- Side-by-Side View: Compare the original image with the generated modern Tamil text.
- Copy to Clipboard: Easily copy the converted text with a single click.
- Responsive Design: Fully functional on both desktop and mobile devices.
- Clear User Feedback: Displays loading states during processing and handles potential errors gracefully.
- Framework: React
- Language: TypeScript
- AI Model: Google Gemini API (
gemini-2.5-flash) via@google/genaiSDK - Styling: Tailwind CSS
- Bundling/Imports: ES Modules with Import Maps (no build step required)
The application follows a simple yet powerful workflow:
- API Key Setup: The app first checks for a Gemini API key. If not found, it prompts the user to enter one.
- Image Upload: The user selects an image containing Old Tamil script.
- Client-Side Processing: The browser converts the image file into a Base64-encoded string.
- API Request: The Base64 image data and the user-provided API key are sent to the Google Gemini API.
- Gemini's Magic: The
gemini-2.5-flashmodel processes the request:- It performs OCR on the image to recognize the Brahmi-derived characters.
- Guided by the prompt, it acts as a Tamil linguistics expert to convert the recognized characters into their Modern Tamil Unicode equivalents.
- It preserves the original word spacing and layout.
- Display Result: The API returns the converted text, which is then displayed in the UI for the user to read and copy.
To run this project, you'll need a Google Gemini API key.
- A modern web browser.
- A Google Gemini API key. You can get one from Google AI Studio.
-
Clone the repository:
git clone https://github.com/your-username/old-tamil-converter.git cd old-tamil-converter -
Run a local web server: Since this project uses ES modules, you need to serve the files from a local server.
# If you have Python 3 python -m http.serverOr use a simple Node.js package:
# Install with: npm install -g serve serve .
-
Open and Configure:
- Navigate to
http://localhost:8000(or the URL provided by your server) in your browser. - The app will prompt you to enter your Gemini API key. This key is stored in your browser's memory and is gone when you close the tab.
- Navigate to
For a quicker local development workflow, you can create an env.js file to avoid entering the key on every page load.
-
Create a new file named
env.jsin the project's root directory.⚠️ Important: This file is listed in.gitignoreand must not be committed to version control. -
Add the following content to
env.js, replacing the placeholder with your actual key:// env.js window.process = { env: { API_KEY: 'YOUR_GEMINI_API_KEY_HERE' } };
The app will automatically detect and use this key when you run it locally.
/
├── components/
│ ├── ApiKeySetup.tsx # Securely prompts for API key
│ ├── Header.tsx # Page header component
│ ├── Icons.tsx # SVG icon components
│ ├── ImageUploader.tsx # Handles image selection and preview
│ ├── Loader.tsx # Loading spinner component
│ └── ResultDisplay.tsx # Displays the converted text or status
│
├── services/
│ └── geminiService.ts # Logic for interacting with the Gemini API
│
├── .gitignore # Ensures sensitive files are not committed
├── App.tsx # Main application component, manages state
├── env.js # Local environment variables (DO NOT COMMIT)
├── index.html # HTML entry point
├── index.tsx # React application root
├── metadata.json # Application metadata
└── README.md # Project documentation
