sameernotes/slimshadow-ocr
1
1<!DOCTYPE html>2<!-- Add lang attribute and potentially 'dark' class -->3<html lang="en" class=""> <!-- Start without 'dark' initially -->4<head>5 <meta charset="UTF-8">6 <meta name="viewport" content="width=device-width, initial-scale=1.0">7 <title>Technology Stack - NIC Project</title>8 <!-- Tailwind CSS via CDN -->9 <script src="https://cdn.tailwindcss.com/3.4.1"></script>10 <script>11 // *** Add dark mode strategy to Tailwind config ***12 tailwind.config = {13 darkMode: 'class', // Enable class-based dark mode14 theme: {15 extend: {16 colors: {17 primary: '#1a73e8',18 secondary: '#e8f0fe',19 // Define dark mode colors if needed, or rely on Tailwind's defaults20 // dark: {21 // background: '#1a202c',22 // text: '#e2e8f0',23 // }24 },25 borderRadius: {26 'none': '0px', 'sm': '4px', DEFAULT: '8px', 'md': '12px',27 'lg': '16px', 'xl': '20px', '2xl': '24px', '3xl': '32px',28 'full': '9999px', 'button': '8px'29 }30 }31 }32 }33 </script>34 <!-- Fonts -->35 <link rel="preconnect" href="https://fonts.googleapis.com">36 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>37 <link href="https://fonts.googleapis.com/css2?family=Pacifico&display=swap" rel="stylesheet">38 <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;700&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">39 <!-- Icons -->40 <link href="https://cdn.jsdelivr.net/npm/remixicon@4.2.0/fonts/remixicon.css" rel="stylesheet">41 <!-- Custom Styles -->42 <style>43 /* --- Font Definitions (Ensure loaded via <link> tags in base.html) --- */44body {45 font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";46 -webkit-font-smoothing: antialiased; /* Smoother fonts */47 -moz-osx-font-smoothing: grayscale;48}49 50.hindi-font {51 font-family: 'Noto Sans Devanagari', sans-serif;52}53 54/* --- Custom Switch Styles (from provided HTML) --- */55.custom-switch {56 position: relative;57 display: inline-block;58 width: 50px;59 height: 24px;60}61 62.custom-switch-input {63 opacity: 0;64 width: 0;65 height: 0;66}67 68.custom-switch-slider {69 position: absolute;70 cursor: pointer;71 top: 0;72 left: 0;73 right: 0;74 bottom: 0;75 background-color: #ccc; /* Default off color */76 transition: .4s;77 border-radius: 34px; /* Rounded */78}79 80.custom-switch-slider:before {81 position: absolute;82 content: "";83 height: 18px;84 width: 18px;85 left: 3px;86 bottom: 3px;87 background-color: white; /* Changed from original rgb(136, 145, 212) to white for consistency with dark mode logic in base.html */88 transition: .4s;89 border-radius: 50%; /* Circle */90}91 92.custom-switch-input:checked + .custom-switch-slider {93 background-color: #1a73e8; /* Primary color when on */94}95 96.custom-switch-input:checked + .custom-switch-slider:before {97 transform: translateX(26px); /* Move the circle */98}99 100/* --- Accessibility: Ensure focus is visible --- */101/* Tailwind's default focus rings are usually good, but this is a fallback */102*:focus-visible {103 outline: 2px solid #1a73e8; /* Use primary color for focus */104 outline-offset: 2px;105 box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.3); /* Optional softer focus ring */106}107 108/* --- Other Minimal Custom Styles (if any) --- */109 110/* Example: Add a specific style for the example image containers if needed beyond grid/aspect ratio */111.example-image-container {112 /* Custom styles here */113 /* aspect-ratio: 3 / 2; */ /* Tailwind handles aspect ratio now */114}115 116.example-image {117 /* Custom image styles here */118}119 /* Add base dark mode styles */120 html.dark body {121 background-color: #1a202c; /* Example dark background */122 color: #e2e8f0; /* Example dark text */123 }124 html.dark header, html.dark footer { /* Adjust header/footer */125 background-color: #2d3748;126 color: #e2e8f0;127 }128 html.dark .card { /* Adjust card styles */129 background-color: #2d3748;130 border-color: #4a5568;131 }132 html.dark h1, html.dark h2, html.dark h3, html.dark h4, html.dark h5, html.dark h6, html.dark p, html.dark span, html.dark li, html.dark label, html.dark small {133 /* Adjust general text elements */134 color: #e2e8f0; /* Light text */135 }136 html.dark .text-gray-600, html.dark .text-gray-700, html.dark .text-gray-800, html.dark .text-gray-900 {137 color: #a0aec0; /* Lighter gray for dark mode */138 }139 html.dark .text-muted {140 color: #718096;141 }142 html.dark .bg-white { background-color: #2d3748 !important; }143 html.dark .bg-gray-50 { background-color: #1a202c !important; }144 html.dark .bg-gray-100 { background-color: #2d3748 !important; }145 html.dark .border-gray-100, html.dark .border-gray-200 { border-color: #4a5568 !important; }146 html.dark .hover\:bg-gray-50:hover { background-color: #4a5568 !important; }147 html.dark .navbar-dark .navbar-brand, html.dark .navbar-dark .nav-link { color: #fff; }148 html.dark .navbar-dark .nav-link.active { color: #fff; font-weight: bold; }149 150 151 </style>152 153</head>154<!-- Add dark mode background/text for body base -->155<body class="bg-gray-50 dark:bg-gray-900 min-h-screen flex flex-col text-gray-900 dark:text-gray-200">156 157 <!-- Header -->158 <header class="bg-white dark:bg-gray-800 shadow-sm sticky top-0 z-50">159 <div class="container mx-auto px-4 py-3 flex items-center justify-between">160 <div class="flex items-center">161 <a href="index.html" class="text-2xl font-['Pacifico'] text-primary dark:text-blue-400 mr-8" data-lang-en="AI Text Tools" data-lang-hi="एआई टेक्स्ट उपकरण">AI Text Tools</a>162 <!-- *** START: Updated Navigation Bar *** -->163 <nav id="mainNav" class="hidden md:flex space-x-6">164 <a href="index.html" class="nav-link hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300" data-lang-en="Home" data-lang-hi="होम">Home</a>165 <!-- Assuming recognizer.html is the main tool page, link from index.html might be better -->166 <a href="recognizer.html" class="nav-link hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300" data-lang-en="Recognize" data-lang-hi="पहचानें">Recognize</a>167 <!-- Assuming examples.html exists -->168 <a href="examples.html" class="nav-link hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300" data-lang-en="Examples" data-lang-hi="उदाहरण">Examples</a>169 <!-- Assuming technology.html exists -->170 <a href="technology.html" class="nav-link text-primary dark:text-blue-400 font-medium" data-lang-en="Technology" data-lang-hi="तकनीक">Technology</a>171 <!-- Assuming about.html exists -->172 <a href="about.html" class="nav-link hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300" data-lang-en="About" data-lang-hi="बारे में">About</a>173 <!-- Link to contact.html -->174 <a href="contact.html" class="nav-link hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300" data-lang-en="Contact" data-lang-hi="संपर्क">Contact</a>175 <!-- Active link for this page -->176 <a href="feedback.html" class="nav-link hover:text-primary dark:hover:text-blue-400 text-gray-600 dark:text-gray-300" data-lang-en="Feedback" data-lang-hi="प्रतिक्रिया">Feedback</a>177 </nav>178 </div>179 <!-- Right side header items -->180 <div class="flex items-center space-x-4">181 <!-- Language Switch -->182 <div class="items-center space-x-2 hidden md:flex">183 <span class="text-sm text-gray-600 dark:text-gray-400">EN</span>184 <label class="custom-switch">185 <!-- *** Add ID: languageToggle *** -->186 <input type="checkbox" id="languageToggle" class="custom-switch-input">187 <span class="custom-switch-slider"></span>188 </label>189 <span class="text-sm text-gray-600 dark:text-gray-400 hindi-font">हिंदी</span>190 </div>191 <!-- Theme Switch -->192 <div class="items-center space-x-2 hidden md:flex">193 <span class="text-sm text-gray-600 dark:text-gray-400"><i class="ri-sun-line"></i></span>194 <label class="custom-switch">195 <!-- *** Add ID: themeToggle *** -->196 <input type="checkbox" id="themeToggle" class="custom-switch-input">197 <span class="custom-switch-slider"></span>198 </label>199 <span class="text-sm text-gray-600 dark:text-gray-400"><i class="ri-moon-line"></i></span>200 </div>201 <!-- User/Notification Icons (Keep as placeholders) -->202 <div class="w-10 h-10 flex items-center justify-center bg-gray-100 dark:bg-gray-700 rounded-full cursor-pointer" title="User Profile (Placeholder)">203 <i class="ri-user-line text-gray-600 dark:text-gray-300"></i>204 </div>205 <div class="w-10 h-10 flex items-center justify-center relative cursor-pointer" title="Notifications (Placeholder)">206 <i class="ri-notification-3-line text-gray-600 dark:text-gray-300"></i>207 <span class="absolute top-0 right-0 bg-red-500 text-white text-xs w-5 h-5 flex items-center justify-center rounded-full">3</span>208 </div>209 <!-- Mobile Menu Button (Placeholder) -->210 <button class="md:hidden w-10 h-10 flex items-center justify-center" aria-label="Toggle Menu">211 <i class="ri-menu-line text-gray-600 dark:text-gray-300 text-xl"></i>212 </button>213 </div>214 </div>215 </header>216 217 <!-- Main Content Area -->218 <main class="flex-grow">219 220<div class="container mx-auto px-4 py-8">221 <div class="max-w-3xl mx-auto">222 <div class="bg-white dark:bg-gray-800 rounded-lg shadow-md border border-gray-200 dark:border-gray-700 overflow-hidden">223 <div class="px-6 py-4 bg-gray-50 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600">224 <h2 class="text-xl font-semibold text-gray-800 dark:text-white flex items-center">225 <i class="ri-flask-line mr-2 text-primary text-2xl"></i> <!-- Flask icon or other relevant icon -->226 Technology Stack & Methodology227 </h2>228 </div>229 <div class="p-6 md:p-8 space-y-6 text-gray-700 dark:text-gray-300 leading-relaxed">230 <h3 class="text-2xl font-semibold text-gray-900 dark:text-white mb-4">Core Components</h3>231 232 <div class="space-y-4">233 <h4 class="text-lg font-semibold text-gray-800 dark:text-white pt-2">1. Deep Learning Model</h4>234 <p>235 The core recognition engine relies on a deep neural network architecture commonly used for sequence recognition tasks, particularly OCR. This typically involves:236 </p>237 <ul class="list-disc list-inside space-y-1 pl-4 text-gray-700 dark:text-gray-300">238 <li><strong>Convolutional Neural Network (CNN) Layers:</strong> These layers act as feature extractors, automatically learning relevant visual patterns (like strokes, curves, loops) directly from the pixel data of the input word images.</li>239 <li><strong>Recurrent Neural Network (RNN) Layers:</strong> Long Short-Term Memory (LSTM) or Gated Recurrent Unit (GRU) layers are often used after the CNN. They process the sequence of features extracted along the width of the image, capturing contextual information and dependencies between different parts of the word. Bidirectional RNNs are commonly employed to consider context from both left-to-right and right-to-left.</li>240 <li><strong>Connectionist Temporal Classification (CTC) Loss:</strong> This loss function is essential for training OCR models without requiring pre-segmented character locations. It calculates the probability of the predicted sequence given the input image features, summing over all possible alignments between the input sequence and the target text label.</li>241 </ul>242 <p class="text-sm text-gray-600 dark:text-gray-400 italic mt-2">243 <em>Specific Library Used: TensorFlow 1.15 (as indicated by logs)</em>244 </p>245 <!-- Optional: Model Diagram Placeholder -->246 <!-- <div class="my-4 p-4 border rounded-md bg-gray-50 text-center text-gray-500">Model Architecture Diagram Placeholder</div> -->247 </div>248 249 <hr class="my-6 border-gray-200 dark:border-gray-600">250 251 <div class="space-y-4">252 <h4 class="text-lg font-semibold text-gray-800 dark:text-white">2. Image Preprocessing</h4>253 <p>254 Raw input images are processed before being fed into the neural network to ensure consistency and optimal performance. Steps (handled by `SamplePreprocessor.py`) include:255 </p>256 <ul class="list-disc list-inside space-y-1 pl-4 text-gray-700 dark:text-gray-300">257 <li><strong>Grayscale Conversion:</strong> Converting the image to a single channel (grayscale) reduces complexity.</li>258 <li><strong>Resizing:</strong> Images are typically resized to a fixed height (e.g., 32 or 64 pixels) while maintaining the aspect ratio. Width may vary or be padded to a maximum length.</li>259 <li><strong>Normalization:</strong> Pixel values are scaled to a standard range (e.g., [0, 1] or [-1, 1]) to stabilize training.</li>260 <li><em>(Mention any other significant steps like binarization, slant correction if applicable)</em></li>261 </ul>262 <p class="text-sm text-gray-600 dark:text-gray-400 italic mt-2">263 <em>Primary Library Used: OpenCV (`cv2`)</em>264 </p>265 </div>266 267 <hr class="my-6 border-gray-200 dark:border-gray-600">268 269 <div class="space-y-4">270 <h4 class="text-lg font-semibold text-gray-800 dark:text-white">3. Backend Framework</h4>271 <p>272 The server-side logic, API handling, and coordination are managed by **Flask**, a Python microframework known for its simplicity and flexibility. Flask's responsibilities in this project include:273 </p>274 <ul class="list-disc list-inside space-y-1 pl-4 text-gray-700 dark:text-gray-300">275 <li>Defining URL routes (e.g., <code>/</code>, <code>/recognize</code>, <code>/predict</code>, <code>/api/examples</code>).</li>276 <li>Handling HTTP requests (GET for pages, POST for predictions).</li>277 <li>Receiving and securely saving uploaded image files.</li>278 <li>Calling the Python functions in <code>main.py</code> to trigger image preprocessing and model inference.</li>279 <li>Formatting the prediction results into JSON for the API endpoint.</li>280 <li>Rendering HTML templates (using the Jinja2 engine) to display web pages.</li>281 <li>Serving static assets like CSS, JavaScript, and images.</li>282 </ul>283 </div>284 285 <hr class="my-6 border-gray-200 dark:border-gray-600">286 287 <div class="space-y-4">288 <h4 class="text-lg font-semibold text-gray-800 dark:text-white">4. Frontend Interface</h4>289 <p>290 The user interacts with the application through a web interface built using:291 </p>292 <ul class="list-disc list-inside space-y-1 pl-4 text-gray-700 dark:text-gray-300">293 <li><strong>HTML5:</strong> Provides the fundamental structure and content of the web pages.</li>294 <li><strong>Tailwind CSS:</strong> A utility-first CSS framework used for rapidly building the user interface. It provides low-level utility classes (like <code>p-6</code>, <code>rounded-lg</code>, <code>text-center</code>, <code>font-semibold</code>, <code>hidden</code>) to style elements directly in the HTML markup, promoting consistency and custom design without writing extensive custom CSS.</li>295 <li><strong>Vanilla JavaScript:</strong> Handles all client-side interactivity, including:296 <ul class="list-['○'] list-inside space-y-1 pl-6 mt-1">297 <li>Managing file input selection and example image clicks.</li>298 <li>Displaying image previews.</li>299 <li>Making asynchronous API calls (<code>fetch</code>) to the Flask backend's <code>/predict</code> endpoint to send the image data.</li>300 <li>Receiving and parsing the JSON response from the backend.</li>301 <li>Dynamically updating the HTML to show prediction results, loading states, or error messages.</li>302 <li>Handling basic UI state changes (e.g., enabling/disabling buttons).</li>303 </ul>304 </li>305 <li><strong>Remixicon / Google Fonts:</strong> Used for icons and specific typography (Inter, Noto Sans Devanagari, Pacifico).</li>306 </ul>307 </div>308 309 </div>310 </div>311 </div>312</div>313 314 </main>315 316 <!-- Footer -->317 <footer class="bg-gray-900 text-gray-400 py-12"> <!-- Adjusted footer text color -->318 <div class="container mx-auto px-4">319 <div class="grid grid-cols-1 md:grid-cols-4 gap-8">320 <div>321 <!-- Add data-lang attributes to footer elements if needed -->322 <a href="/" class="text-2xl font-['Pacifico'] text-white mb-4 inline-block" data-lang-en="HindiOCR" data-lang-hi="हिन्दी ओसीआर">HindiOCR</a>323 <p class="mb-4 text-sm" data-lang-en="Transforming handwritten Hindi documents into digital text." data-lang-hi="हस्तलिखित हिंदी दस्तावेज़ों को डिजिटल टेक्स्ट में बदलना।">Transforming handwritten Hindi documents into digital text.</p>324 <div class="flex space-x-4">325 <a href="#" class="hover:text-white" title="GitHub (Placeholder)"><i class="ri-github-fill"></i></a>326 <a href="#" class="hover:text-white" title="LinkedIn (Placeholder)"><i class="ri-linkedin-box-fill"></i></a>327 </div>328 </div>329 <div>330 <h3 class="text-lg font-medium text-white mb-4" data-lang-en="Quick Links" data-lang-hi="त्वरित लिंक्स">Quick Links</h3>331 <ul class="space-y-2 text-sm">332 <li><a href="/" class="hover:text-white" data-lang-en="Home" data-lang-hi="होम">Home</a></li>333 <li><a href="/recognize" class="hover:text-white" data-lang-en="Recognize" data-lang-hi="पहचानें">Recognize</a></li>334 <li><a href="/examples" class="hover:text-white" data-lang-en="Examples" data-lang-hi="उदाहरण">Examples</a></li>335 <li><a href="/technology" class="hover:text-white" data-lang-en="Technology" data-lang-hi="तकनीक">Technology</a></li>336 <li><a href="/about" class="hover:text-white" data-lang-en="About" data-lang-hi="बारे में">About</a></li>337 </ul>338 </div>339 <div>340 <h3 class="text-lg font-medium text-white mb-4" data-lang-en="Resources" data-lang-hi="संसाधन">Resources</h3>341 <ul class="space-y-2 text-sm">342 <li><a href="#" class="hover:text-white" data-lang-en="Documentation (TBD)" data-lang-hi="प्रलेखन (TBD)">Documentation (TBD)</a></li>343 <li><a href="#" class="hover:text-white" data-lang-en="GitHub Repo (Link)" data-lang-hi="गिटहब रेपो (लिंक)">GitHub Repo (Link)</a></li>344 <li><a href="#" class="hover:text-white" data-lang-en="Support (TBD)" data-lang-hi="समर्थन (TBD)">Support (TBD)</a></li>345 </ul>346 </div>347 <div>348 <h3 class="text-lg font-medium text-white mb-4" data-lang-en="Contact (Project)" data-lang-hi="संपर्क (परियोजना)">Contact (Project)</h3>349 <ul class="space-y-2 text-sm">350 <li class="flex items-start">351 <i class="ri-mail-line mt-1 mr-2"></i>352 <span>khansamayashaswini@gmail.com</span>353 </li>354 <li class="flex items-center">355 <i class="ri-building-line mr-2"></i>356 <span>MATS University,Raipur / NIC Durg</span>357 </li>358 </ul>359 </div>360 </div>361 <!-- Copyright -->362 <div class="border-t border-gray-700 mt-8 pt-8 text-center">363 <p class="text-sm">© 2025 Yashaswini khansama | Final Year Project | NIC</p>364 </div>365 </div>366 </footer>367 368 <!-- Bootstrap JS Bundle (Not needed for Tailwind, can remove if not used elsewhere) -->369 <!-- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script> -->370 371 <!-- Base Theme/Language Script -->372 <script>373 // --- Theme Toggle ---374 const themeToggle = document.getElementById('themeToggle');375 const htmlElement = document.documentElement; // Target <html> tag376 377 // Function to apply theme based on preference378 function applyTheme(isDark) {379 if (isDark) {380 htmlElement.classList.add('dark');381 if(themeToggle) themeToggle.checked = true;382 console.log("Theme applied: dark");383 } else {384 htmlElement.classList.remove('dark');385 if(themeToggle) themeToggle.checked = false;386 console.log("Theme applied: light");387 }388 }389 390 // Check localStorage on load391 const prefersDark = localStorage.getItem('theme') === 'dark' ||392 (localStorage.getItem('theme') === null && window.matchMedia('(prefers-color-scheme: dark)').matches);393 applyTheme(prefersDark);394 395 // Add listener to toggle button396 if(themeToggle){397 themeToggle.addEventListener('change', (event) => {398 const isDark = event.target.checked;399 applyTheme(isDark);400 // Save preference to localStorage401 localStorage.setItem('theme', isDark ? 'dark' : 'light');402 });403 } else {404 console.warn("Theme toggle button not found.");405 }406 407 // --- Language Toggle (Simple Version) ---408 const languageToggle = document.getElementById('languageToggle');409 const langElements = document.querySelectorAll('[data-lang-en]'); // Select elements with language data410 411 // Function to apply language412 function applyLanguage(lang) { // lang should be 'en' or 'hi'413 console.log("Applying language:", lang);414 htmlElement.setAttribute('lang', lang); // Set overall page lang415 416 langElements.forEach(el => {417 const text = el.getAttribute(`data-lang-${lang}`);418 if (text) {419 el.textContent = text; // Replace text content420 }421 });422 423 // Update toggle state424 if (languageToggle) languageToggle.checked = (lang === 'hi');425 426 // Save preference427 localStorage.setItem('language', lang);428 }429 430 // Check localStorage on load for language431 const savedLang = localStorage.getItem('language') || 'en'; // Default to English432 applyLanguage(savedLang);433 434 // Add listener to language toggle button435 if (languageToggle) {436 languageToggle.addEventListener('change', (event) => {437 const newLang = event.target.checked ? 'hi' : 'en';438 applyLanguage(newLang);439 });440 } else {441 console.warn("Language toggle button not found.");442 }443 444 </script>445 446 <!-- Block for page-specific scripts -->447 448</body>449</html>